HP aC++/HP C A.06.25 Programmer's Guide

4 Preprocessing Directives..........................................................................................................157
Overview of the Preprocessor...........................................................................................157
Syntax..........................................................................................................................157
Usage Guidelines.........................................................................................................158
Source File Inclusion (#include, #include_next)..........................................................158
Syntax.....................................................................................................................158
Description.............................................................................................................158
Examples................................................................................................................159
Macro Replacement (#define, #undef)........................................................................159
Syntax.....................................................................................................................159
Description.............................................................................................................159
Macros with Parameters.........................................................................................160
Specifying String Literals with the # Operator......................................................161
Concatenating Tokens with the ## Operator .........................................................161
Example 1..........................................................................................................161
Example 2..........................................................................................................162
Using Macros to Define Constants.........................................................................163
Other Macros..........................................................................................................163
Example 1..........................................................................................................164
Example 2..........................................................................................................164
Using Constants and Inline Functions Instead of Macros.....................................164
Example............................................................................................................164
Predefined Macros.................................................................................................165
Assertions (#assert, #unassert).....................................................................................166
Syntax.....................................................................................................................166
Description.............................................................................................................166
Conditional Compilation (#if, #ifdef, .. #endif)...........................................................166
Syntax.....................................................................................................................167
Description.............................................................................................................167
Using the defined Operator...................................................................................167
Using the #if Directive............................................................................................168
The #endif Directive...............................................................................................168
Using the #ifdef and #ifndef Directives..................................................................168
Nesting Conditional Compilation Directives........................................................168
Using the #else Directive........................................................................................168
Using the #elif Directive.........................................................................................168
Examples................................................................................................................169
Line Control (#line)......................................................................................................169
Syntax.....................................................................................................................169
Description.............................................................................................................169
Example..................................................................................................................170
IOSTREAM Performance Improvement Pragma........................................................170
Syntax:....................................................................................................................170
Pragma Directive (#pragma) and _Pragma Operator.................................................170
12 Table of Contents