C/C++ Programmer's Guide (G06.25+)
Preprocessor Directives and Macros
HP C/C++ Programmer’s Guide for NonStop Servers—429301-002
12-7
#include
The compiler ignores the source text following the #ifdef TNS directive because
TNS is undefined:
#define PC 1
#ifdef TNS
/* HP Tandem dependent code. */
printf("This program executes on the server.\n");
#endif
#ifdef PC
/* pc dependent code. */
printf("This program executes on the pc.\n");
#endif
4. This example shows how the #ifndef directive works. Because TNS is not
defined as a macro, the compiler processes the source text following the #ifndef
TNS directive. The compiler ignores the source text following the #ifndef PC
directive because PC is defined:
#define PC 1
#ifndef TNS
printf("TNS is not currently defined.\n");
#endif
#ifndef PC
printf("PC is not currently defined.\n");
#endif
#include
The #include directive includes source text from a specified file.
source_specifier
specifies the location of the program text that the compiler includes in the
compilation.
source_file
is the file name of the source file you want to include. In the Guardian
environment, the compiler searches for source_file using the SSV search list.
#include source_specifier [ nolist ] newline
source-specifier:
{ " source_file [ section_list ] " } |
{ < library_header_file [ section_list ] > }
section_list:
( section_name [ , section_name ]... )