#pragma options


The #pragma options directive specifies compiler options for your source program.


Read syntax diagramSkip visual syntax diagram                           .--------------------------------------.
                           V                                      |
              '-options-'    |                    .-;---------. |
                             |                    | .-,-----. | |
                             |                    V V       | | |


By default, pragma options generally apply to the entire compilation unit.

To specify more than one compiler option with the #pragma options directive, separate the options using a blank space. For example:

#pragma options langlvl=stdc89 halt=s spill=1024 source

Most #pragma options directives must come before any statements in your source program; only comments, blank lines, and other #pragma specifications can precede them. For example, the first few lines of your program can be a comment followed by the #pragma options directive:

/* The following is an example of a #pragma options directive: */
#pragma options langlvl=stdc89 halt=s spill=1024 source
/* The rest of the source follows ... */

Options specified before any code in your source program apply to your entire compilation unit. You can use other #pragma directives throughout your program to turn an option on for a selected block of source code. For example, you can request that parts of your source code be included in your compiler listing:

#pragma options source 
/*  Source code between the source and nosource #pragma
    options is included in the compiler listing                */
#pragma options nosource

The settings in the table below are valid options for #pragma options. For more information, refer to the pages of the equivalent compiler option.

Valid settings for #pragma options option_keyword Compiler option equivalent Description
align=option -qalign Specifies what aggregate alignment rules the compiler uses for file compilation.
[no]ansialias -qansialias Specifies whether type-based aliasing is to be used during optimization.
assert=option -qassert Requests the compiler to apply aliasing assertions to your compilation unit.


-qattr Produces an attribute listing containing all names.
chars=option -qchars

See also #pragma chars

Instructs the compiler to treat all variables of type char as either signed or unsigned.
[no]check -qcheck Generates code which performs certain types of runtime checking.
[no]compact -qcompact When used with optimization, reduces code size where possible, at the expense of execution speed.
[no]dbcs -qmbcs, -qdbcs String literals and comments can contain DBCS characters.
C only [no]dbxextra -qdbxextra Generates symbol table information for unreferenced variables.
[no]digraph -qdigraph Allows special digraph and keyword operators.
[no]dollar -qdollar Allows the $ symbol to be used in the names of identifiers.
enum=option -qenum

See also #pragma enum

Specifies the amount of storage occupied by the enumerations.
[no]extchk -qextchk Performs external name type-checking and function call checking.
flag=option -qflag Specifies the minimum severity level of diagnostic messages to be reported.

Severity levels can also be specified with:

#pragma options flag=i => #pragma report (level,I)

#pragma options flag=w => #pragma report (level,W)

#pragma options flag=e,s,u => #pragma report (level,E)

float=[no]option -qfloat Specifies various floating point options to speed up or improve the accuracy of floating point operations.
[no]flttrap=option -qflttrap Generates extra instructions to detect and trap floating point exceptions.
[no]fold -qfold Specifies that constant floating point expressions are to be evaluated at compile time.
[no]fullpath -qfullpath Specifies the path information stored for files for dbx stabstrings.
[no]funcsect -qfuncsect Places intructions for each function in a separate cset.
halt -qhalt Stops compiler when errors of the specified severity detected.
[no]idirfirst -qidirfirst Specifies search order for user include files.
[no]ignerrno -qignerrno Allows the compiler to perform optimizations that assume errno is not modified by system calls.
ignprag=option -qignprag Instructs the compiler to ignore certain pragma statements.
[no]info=option -qinfo

See also #pragma info

Produces informational messages.
initauto=value -qinitauto Initializes automatic storage to a specified hexadecimal byte value.
[no]inlglue -qinlglue Generates fast external linkage by inlining the pointer glue code necessary to make a call to an external function or a call through a function pointer.
isolated_call=names -qisolated_call

See also #pragma isolated_call

Specifies functions in the source file that have no side effects.
C only langlvl -qlanglvl Specifies different language levels.

This directive can dynamically alter preprocessor behavior. As a result, compiling with the -E compiler option may produce results different from those produced when not compiling with the -E option.

[no]ldbl128 -qldbl128, -qlongdouble Increases the size of long double type from 64 bits to 128 bits.
[no]libansi -qlibansi Assumes that all functions with the name of an ANSI C library function are in fact the system functions.
[no]list -qlist Produces a compiler listing that includes an object listing.
[no]longlong -qlonglong Allows long long types in your program.
C only [no]macpstr -qmacpstr Converts Pascal string literals into null-terminated strings where the first byte contains the length of the string.
[no]maf -qmaf Specifies whether floating-point multiply-add instructions are to be generated.
[no]maxmem=number -qmaxmem Instructs the compiler to halt compilation when a specified number of errors of specified or greater severity is reached.
[no]mbcs -qmbcs, -qdbcs String literals and comments can contain DBCS characters.
-O, -qoptimize Specifies the optimization level to apply to a section of program code.

The compiler will accept the following values for number:

  • 0 - sets level 0 optimization
  • 2 - sets level 2 optimization
  • 3 - sets level 3 optimization

If no value is specified for number, the compiler assumes level 2 optimization.

C++ only priority=number -qpriority

See also #pragma priority

Specifies the priority level for the initialization of static constructors
[no]proclocal, [no]procimported, [no]procunknown -qproclocal, -qprocimported, -qprocunknown Marks functions as local, imported, or unknown.
C only [no]proto -qproto If this option is set, the compiler assumes that all functions are prototyped.
[no]ro -qro Specifies the storage type for string literals.
[no]roconst -qroconst Specifies the storage location for constant values.
[no]roptr -qroptr Specifies the storage location for constant pointers.
[no]rrm -qrrm Prevents floating-point optimizations that are incompatible with runtime rounding to plus and minus infinity modes.
[no]showinc -qshowinc If used with -q-qsource, all include files are included in the source listing.
[no]source -qsource Produces a source listing.
spill=number -qspill Specifies the size of the register allocation spill area.
C only [no]srcmsg -qsrcmsg Adds the corresponding source code lines to the diagnostic messages in the stderr file.
[no]stdinc -qstdinc Specifies which files are included with #include <file_name> and #include "file_name" directives.
[no]strict -qstrict Turns off aggressive optimizations of the -O3 compiler option that have the potential to alter the semantics of your program.
tbtable=option -qtbtable Changes the length of tabs as perceived by the compiler.
tune=option -qtune Specifies the architecture for which the executable program is optimized.

-qunroll Unrolls inner loops in the program by a specified factor.
C only [no]upconv -qupconv Preserves the unsigned specification when performing integral promotions.
C++ only [no]vftable -qvftable Controls the generation of virtual function tables.
[no]xref -qxref Produces a compiler listing that includes a cross-reference listing of all identifiers.

Related information