A preprocessor directive is terminated by a newline character.

Preprocessor directives, as well as normal source lines, can be continued over several lines. End the lines that are to be continued with a backslash (\).

Some directives can take actual arguments or values.

Comments in the source file that are not passed through the preprocessor are replaced with a single white space character (ASCII character number decimal 32).

Preprocessor directives provide the following functionality:

Source File Inclusion (#include, #include_next)

Macro Replacement (#define, #undef)

Assertions (#assert, #unassert)

Conditional Compilation ( #if, #ifdef, .. #endif)

Line Control (#line)

Pragma Directive (#pragma, _Pragma operator)

Error Directive (#error)

Trigraph Sequences

Warning Directive

Source File Inclusion (#include, #include_next)

You can include the contents of other files within the source file using the #include or #include_next directives.

Syntax

include-directive ::= #include <filename> #include "filename" #include identifier

include_next-directive ::= #include_next <filename> #include_next "filename" #include_next identifier

Description

The #include preprocessing directive causes HP aC++ to read source input from the file named in the directive. Usually, include files are named filename.h.

If the file name is enclosed in angle brackets (< >), the default system directories are searched to find the named file. If the file name is enclosed in double quotation marks (“ “), by default, the directory of the file containing the #include line is searched first, then directories named in -Ioptions in left-to-right order, and last directories on a standard list.

The arguments to the #include directive are subject to macro replacement before being processed. Thus, if you use a #include directive of the form #include identifier, identifier must be a previously defined macro that when expanded produces one of the above defined forms of the #include directive. Refer to Macro Replacement (#define, #undef) for more information on macros.

Error messages produced by HP aC++ indicate the name of the #include file where the error occurred, as well as the line number within the file.

120 Preprocessing Directives

Page 120
Image 120
HP C/aC++ for PA-RISC Software manual Source File Inclusion #include, #includenext, Syntax, Description