HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
Without using the defined operator, you would have to include the following two directives
to perform the above example:
#ifdef max
#ifndef min
Using the #if Directive
The #if preprocessing directive has the form:
#ifconstant-expression
Use #if to test an expression. HP aC++ evaluates the expression in the directive. If the
expression evaluates to a non-zero value (TRUE), the code following the directive is
included. Otherwise, the expression evaluates to FALSE and HP aC++ ignores the code
up to the next #else, #endif, or #elif directive.
All macro identifiers that appear in the constant-expression are replaced by their current
replacement lists before the expression is evaluated. All defined expressions are replaced
with either 1 or 0 depending on their operands.
The #endif Directive
Whichever directive you use to begin the condition (#if, #ifdef, or #ifndef), you
must use #endif to end the if section.
Using the #ifdef and #ifndef Directives
The following preprocessing directives test for a definition:
#ifdef identifier
#ifndef identifier
These preprocessing directives behave like the #if directive, but #ifdef is considered
true if the identifier was previously defined using a #define directive or the -D option.
#ifndef is considered TRUE if the identifier is not defined yet.
Nesting Conditional Compilation Directives
Use the #else directive to specify an alternative section of code to be compiled if the
#if, #ifdef, or #ifndef conditions fail. The code after the #else directive is included
if the code following any of the #if directives is not included.
Using the #else Directive
Use the #else directive to specify an alternative section of code to be compiled if the
#if, #ifdef, or #ifndef conditions fail. The code after the #else directive is included
if the code following any of the #if directives is not included.
Overview of the Preprocessor 157