XL C/C++ supports three forms of pragma directives:
- #pragma options option_name
- These pragmas use exactly the same syntax as their command-line
option equivalent. The exact syntax and list of supported pragmas of this
type are provided in #pragma options.
- #pragma name
- This form uses the following syntax:
.------------------------.
V |
>>-#--pragma----name--(--suboptions--)-+-----------------------><
The name is the pragma directive name,
and the suboptions are any required or optional suboptions
that can be specified for the pragma, where applicable.
- _Pragma ("name")
- This form uses the following syntax:
.------------------------.
V |
>>-_Pragma--(--"----name--(--suboptions--)-+--"--)-------------><
For example, the statement:
_Pragma ( "pack(1)" )
is equivalent
to:
#pragma pack(1)
For all forms of pragma statements, you can specify more than one
name and
suboptions in a single
#pragma statement.
The name on a pragma is subject to macro substitutions,
unless otherwise stated. The compiler ignores unrecognized pragmas, issuing
an informational message indicating this.
If you have any pragmas that are not common to both C and C++
in code that will be compiled by both compilers, you may add conditional compilation
directives around the pragmas. (This is not strictly necessary since unrecognized
pragmas are ignored.) For example,
#pragma
object_model is only recognized by the C++ compiler, so you may decide
to add conditional compilation directives around the pragma.
#ifdef __cplusplus
#pragma object_model(pop)
#endif