HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)

The +O2 option performs level 2 optimization. This includes level 1 optimizations plus
optimizations performed over entire functions in a single file.
NOTE: Compiling with this optimization setting may require additional memory
resources. Refer to the memory resource discussion above.
Example:
This command compiles prog.C and optimizes at level 2:
aCC +O2 prog.C
+O3
+O3
The +O3 option performs level 3 optimization. This includes level 2 optimizations plus
full optimization across all subprograms within a single file.
NOTE: Compiling with this optimization setting may require additional memory
resources. Refer to the memory resource discussion above.
Example:
This command compiles prog.C and optimizes at level 3:
aCC +O3 prog.C
+O4
+O4
The +O4 option performs level 4 optimization. This includes level 3 optimizations plus
full optimizations across the entire application program. Also, the defaults that depend
on optimization will be the defaults for +O3.
When you link a program, the compiler brings all modules that were compiled at
optimization level 4 into virtual memory at the same time. Depending on the size and
number of the modules, compiling at +O4 can consume a large amount of virtual memory.
If you are linking a large program that was compiled with the +O4 option, you may
notice a system slow down. In the worst case, you may see an error indicating that you
have run out of memory.
NOTE: Compiling with this optimization setting may require additional memory
resources. Refer to the memory resource discussion above.
Example:
This command compiles prog.C and optimizes at level 4:
aCC +O4 prog.C
Code Optimizing Options 65