C/C++ Programmer's Guide (G06.25+)
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
13-84
SECTION
SECTION
The SECTION pragma gives a name to a section of a source file for use in an
#include directive. Sections enable you to include only a portion of a file.
sec-name
is a valid C identifier to associate with all source text that follows the SECTION
pragma until another SECTION pragma or the end of the source file.
There is no default setting for this pragma.
Usage Guidelines
•
The SECTION pragma can appear only in the source text.
•
A section terminates at the next SECTION pragma or, if there are no more
SECTION pragmas, at the end of the file.
Example
This example shows that file1 contains three sections:
#pragma SECTION namea
/* ... */
#pragma SECTION nameb
/* ... */
#pragma SECTION namec
To use these sections so that fileA contains sections namea and namec, and fileB
contains section nameb, fileA should contain:
#include "file1(namea, namec)”
and fileB should contain:
#include "file1(nameb)"
SECTION sec-name
Note. Do not use the #pragma ONCE in a header file that contains the #pragma SECTION.
The expected behavior of this combination is undefined.