C/C++ Programmer's Guide (G06.25+)
Preprocessor Directives and Macros
HP C/C++ Programmer’s Guide for NonStop Servers—429301-002
12-9
#include
In RVUs preceding D30.00, if the #include specification was of the form
#include "subvolume.file", the Guardian compiler checked for the
subvolume in the current volume by default. Beginning with D30.00, you must
specify the default volume using an SSV pragma.
•
If you need more than one physical line to complete the section list, place a
backslash (\) at the end of all but the last line of the list. The backslashes cause
these physical lines to be concatenated into a single logical line. For example, the
following is translated as a single logical line:
#include <cextdecs( \
PROCESS_GETINFOLIST_, \
FILE_OPEN_, \
WRITE, \
WRITEREAD \
)>
•
The OSS environment and some operating systems use file names that consist of
a name and an extension separated by a period. On such systems, the names of
library header files are specified as name.h. The C compiler allows this format in
the #include directive.
For compilations in the Guardian environment, the C compiler translates name.h
to nameh. For example, stdio.h becomes stdioh. If the name portion exceeds
7 characters, the C compiler truncates it to 7 characters.
•
For TNS compilations, included files can be nested to a depth of 16. For example,
file f1 includes file f2, file f2 includes file f3, and so on until file f15 includes
file f16.
•
For TNS compilations, the maximum number of #include directives that can
appear in a single compilation unit is 2048. If the same include file occurs twice in
a compilation unit, that file is counted twice because it appears in two different
#include directives.
Examples
1. This example includes the stdioh header file, specified for the Guardian
environment:
#include <stdioh>
2. This example includes the stdio.h header file, specified for the OSS
environment:
#include <stdio.h>
3. This example includes the file mysource from the current volume and subvolume
or current working directory:
#include "mysource"