Specify Compiler Options in Your Program Source Files

You can specify compiler options within your program source by using #pragma directives.

A pragma is an implementation-defined instruction to the compiler. It has the general form given below, where character_sequence is a series of characters that give specific compiler instruction and arguments, if any.


Syntax Diagram

The character_sequence on a pragma is subject to macro substitutions, unless otherwise stated. More than one pragma construct can be specified on a single #pragma directive. The compiler ignores unrecognized pragmas, issuing an informational message indicating this.

Options specified with pragma directives in program source files override all other option settings, except other pragma directives. The effect of specifying the same pragma directive more than once varies. See the description for each pragma for specific information.

Pragma settings can carry over into included files. To avoid potential unwanted side-effects from pragma settings, you should consider resetting pragma settings at the point in your program source where the pragma-defined behavior is no longer required. Some pragma options offer reset or pop suboptions to help you do this.

These #pragma directives are listed in the detailed descriptions of the options to which they apply. For complete details on the various #pragma preprocessor directives, see General Purpose Pragmas.

Related Concepts

Compiler Options

Related Tasks

Invoke the Compiler
Specify Compiler Options on the Command Line
Specify Compiler Options in a Configuration File
Specify Compiler Options for Architecture-Specific, 32- or 64-bit Compilation
Resolving Conflicting Compiler Options

Related References

General Purpose Pragmas
Pragmas to Control Parallel Processing IBM Copyright 2003