ILE C/C++ Compiler Reference


Pragma directive syntax

There are two forms of pragma directives supported in the ILE C/C++ compilers:

#pragma name

This form uses the following syntax:

Read syntax diagramSkip visual syntax diagram#pragma name 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.

C++ compiler only

_Pragma ("name")

This form uses the following syntax:

Read syntax diagramSkip visual syntax diagram_Pragma("name") 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 (C++) or warning message (C) indicating the unrecognized pragma.

If you have any pragmas that are not common to both C and C++ in code that is compiled by both compilers, you should add conditional compilation directives around the pragmas. (These directives are not strictly necessary since unrecognized pragmas are ignored.) For example, #pragma info is only recognized by the C++ compiler, so you might decide to add conditional compilation directives around the pragma.

#ifdef __cplusplus
#pragma info(none)
#endif

[ Top of Page | Previous Page | Next Page | Contents | Index ]