Start of change

Scope of Pragma directives

Many pragma directives can be specified at any point within the source code in a compilation unit; others must be specified before any other directives or source code statements. The individual descriptions for each pragma describe any constraints on the placement of the pragma.

In general, if you specify a pragma directive before any code in your source program, it applies to the entire compilation unit, including any header files that are included. For a directive that can appear anywhere in your source code, it applies from the point at which it is specified, until the end of the compilation unit.

You can further restrict the scope of the application of a pragma by using complementary pairs of pragma directives around a selected section of code. For example, using #pragma datamodel directives as follows requests that only the selected parts of your source code use a particular data model setting:

/* Data model may be P128 or LLP64 */
#pragma datamodel(P128)
/* Data model P128 is now in effect */
#pragma datamodel(pop)
/* Prior data model is now in effect */

Many pragma directives provide "pop“ or "reset" suboptions that allow you to enable and disable pragma settings in a stack-based fashion; examples of these suboptions are provided in the relevant pragma descriptions.

End of change

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