#pragma option_override

Description

The #pragma option_override directive lets you specify alternate optimization options to apply to specific functions.

Syntax

Read syntax diagramSkip visual syntax diagram                                         .-,------------.
                                         V              |
>>-#--pragma--option_override--(--fname----"--option--"-+--)---><

Valid settings and syntax for option, and their corresponding command line options, are shown below:

Settings and Syntax for #pragma option_override option Command Line Option Examples
opt(level,number) -O, -O2, -O3, -O4, -O5 #pragma option_override (fname, "opt(level, 3)")
opt(registerSpillSize,num) -qspill=num #pragma option_override (fname, "opt(registerSpillSize,512)")
opt(size[,yes]) -qcompact #pragma option_override (fname, "opt(size)")
#pragma option_override (fname, "opt(size,yes)")
opt(size,no) -qnocompact #pragma option_override (fname, "opt(size,no)")
opt(strict) -qstrict #pragma option_override (fname, "opt(strict)")
opt(strict,no) -qnostrict #pragma option_override (fname, "opt(strict,no)")

Notes

By default, optimization options specified on the command line apply to the entire source program. However, certain types of runtime errors may occur only when optimization is turned on. This pragma lets you override command line optimization settings for specific functions (fname) in your program, which may be useful in identifying and correcting programming errors in those functions.

Per-function optimizations have effect only if optimization is already enabled by compilation option. You can request per-function optimizations at a level less than that applied to the rest of the program being compiled. Selecting options through this pragma affects only the specific optimization option selected, and does not affect the implied settings of related options.

Options are specified in double quotes, so they are not subject to macro expansion. The option specified within quotes must comply with the syntax of the build option.

This pragma cannot be used with overloaded member functions.

This pragma affects only functions defined in your compilation unit and can appear anywhere in the compilation unit, for example:

Related information