C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Preprocessor Directives and Macros
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
12-5
#if, #elif, #ifdef, #ifndef, #else, and #endif
#if int-constant-expression newline [ source-text ]
introduces an if section that conditionally includes source text based on the value
of a constant expression. The new line following the constant expression
terminates the #if directive line, and source-text is the text included if int-
constant-expression has a nonzero value.
The constant expression must evaluate to an integral value; also, it cannot include
sizeof or cast operators or an enumeration constant.
#elif int-constant-expression newline [ source-text ]
introduces an if section that conditionally includes source text based on the value
of a constant expression. The new line following the constant expression
terminates the #elif directive line, and source-text is the text included if int-
constant-expression has a nonzero value.
The constant expression must evaluate to an integral value; also, it cannot include
sizeof or cast operators or an enumeration constant.
The maximum number of nested #elif directives is 32.
#ifdef identifier newline [ source-text ]
introduces an if section that conditionally includes source text based on the
existence of an identifier as a macro name. identifier specifies the identifier to
test, and the new line following it terminates the #ifdef directive line. source-
text is the source text that is included if identifier is currently defined as a
macro name.
#ifndef identifier newline [ source-text ]
introduces an if section that conditionally includes source text based on the
nonexistence of an identifier as a macro name. identifier specifies the
if-section:
if-group
[ else-group ]
#endif newline
if-group:
{ #if int-constant-expression } newline [ source-text ]
{ #elif int-constant-expression }
{ #ifdef identifier }
{ #ifndef identifier }
#else-group:
#else newline [ source-text ]