C/C++ Programmer's Guide (G06.25+)

Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
13-73
OVERFLOW_TRAPS
Because it does not affect statement boundaries, optimization level 1 is useful
when you are developing and debugging your program.
°
Optimization level 2 provides both intrastatement and interstatement
optimizations. Interstatement optimizations can affect statement boundaries,
which, in turn, can make debugging a program more difficult. Consequently,
you should use optimization level 2 only after your program is thoroughly
debugged and tested.
The OPTIMIZE pragma affects native C and C++ programs as follows:
°
Optimization level 0 disables all optimizations and therefore yields code with
relatively poor performance. Optimization level 0 is useful when you are
developing and debugging your program and is recommended for serious
debugging. Statements are well-defined when debugging; breakpoints and
stepping occurs in a manner that the user would expect when viewing the
related source.
°
Optimization level 1 generates optimized code sequences. Object code
compiled at optimization level 1 can be symbolically debugged; statement
boundaries, however, might be blurred. The Inspect, Native Inspect, and Visual
Inspect debuggers choose a sensible location when a user requests a
breakpoint on a source statement, but their definition of statement boundaries
does not always coincide directly with source statements. The debugger emits
a warning when a process is held at a statement for which the code associated
with a previous source statement has not yet executed.
°
Optimization level 2 generates the most optimized code sequences. Object
code compiled at optimization level 2 cannot be symbolically debugged with a
symbolic debugger. Machine-level debugging might be necessary.
For information on setting TNS/R code optimization levels, see the TNS/R Native
Application Migration Guide. For information on setting TNS/E code optimization levels,
see the H-Series Application Migration Guide. See also OPTFILE on page 13-71.
OVERFLOW_TRAPS
The OVERFLOW_TRAPS pragma determines whether the native C and C++ compilers
generate code with arithmetic overflow traps. The compiler generates code that traps
(issues a signal) on arithmetic overflow if OVERFLOW_TRAPS is set. The compiler does
not generate code that traps on arithmetic overflow if NOOVERFLOW_TRAPS is set.
[ NO ]OVERFLOW_TRAPS