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

#pragma OPT_LEVEL 4
#pragma OPT_LEVEL INITIAL
When used with a numeric argument, the OPT_LEVEL pragma sets the optimization
level to 0, 1, 2, 3, or 4.
The INITIAL argument causes the optimization level in effect at the start of the
compilation, whether by default or specified on the command line, to be restored.
Example:
aCC -O prog.C
#pragma OPT_LEVEL 1
void A(){ // Optimize this function at level 1.
...
}
#pragma OPT_LEVEL 2
void B(){ // Restore optimization to level 2.
...
}
NOTE: This pragma cannot raise the optimization level above the level specified in
the command line.
This pragma cannot be used within a function.
OPTIMIZE Pragma
#pragma OPTIMIZE ON|OFF
NOTE: This pragma is deprecated as of HP C/C++ A.06.15. You should use: #pragma
OPT_LEVEL instead.
This pragma is used to toggle between optimization on and optimization off for different
sections of source code whenever they are encountered in a top-to-bottom read of a
source file.
Example:
The following example toggles between optimization on and optimization off:
aCC +O2 prog.C
#pragma OPTIMIZE OFF
void A(){ // Turn off optimization
... // for this function
}
#pragma OPTIMIZE ON
void B(){ // Restore optimization
... // to level 2.
}
You must specify one of the optimization level options on the aCC command, otherwise
this pragma is ignored. This pragma cannot be used within a function.
Optimization Pragmas 125