#define Name TokenString |
Replaces subsequent instances of Name with TokenString. |
#define Name(Argument,...,Argument) TokenString |
Replaces subsequent instances of the sequence Name (Argument, . . . ,Argument) with TokenString, where each occurrence
of an Argument in TokenString is replaced by the corresponding token in the comma-separated list.
Note that there must not be any space between Name
and the left parenthesis. |
#undef Name |
Ignores the definition of Name from this
point on. |
#include "File" or #include <File> |
Includes at this point the contents of File,
which cpp then processes.
If
you enclose File in " " (double quotation marks)
the cpp command searches first in the directory of InFile, second in directories named with the -I flag, and last in directories on a standard list.
If you use the <File> notation, the cpp command searches for File only in the standard
directories. It does not search the directory in which InFile resides. |
#line Number ["File"] |
Causes the implementation to behave as if the following sequence
of source lines begins with a source line that has a line number as specified
by Number. If File is supplied,
the presumed name of the file is changed to be File. |
#error TokenString |
Produces a diagnostic message that includes TokenString. |
#pragma TokenString |
An implementation-defined instruction to the compiler. |
#endif |
Ends a section of lines begun by a test directive (#if, #ifdef, or #ifndef).
Each test directive must have a matching #endif. |
#ifdef Name |
Places the subsequent lines in the output only if:
Name has been defined by a previous #define
OR
Name has been defined by the -D
flag,
OR
Name is a special name recognized by the cpp
command,
AND
Name has not been undefined by an intervening #undef,
OR
Name has not been undefined with the -U flag. |
#ifndef Name |
Places the subsequent lines in the output only if:
Name has never been defined by a previous #define,
AND
Name is not a special name recognized by the cpp command,
OR
Name has been defined by a previous #define but it has been undefined by an intervening #undef,
OR
Name is a special name recognized by the cpp command, but it has been undefined with the -U
flag. |
#if Expression |
Places subsequent lines in the output only if Expression evaluates to nonzero. All the binary nonassignment C operators,
the ?: operator, and the unary -, !, and - operators are legal in Expression. The precedence of the operators is the same as that defined
in the C Language. There is also a unary operator defined, which can be used in Expression in these two
forms:
- defined (Name)
or defined Name
- This allows the utility of #ifdef and #ifndef in a #if directive. Only these operators,
integer constants, and names that are known by cpp
should be used in Expression. The sizeof operator is not available.
|
#elif Expression |
Places subsequent lines in the output only if the expression in
the preceding #if or #elif directive
evaluates to false or is undefined, and this Expression evaluates to true. |
#else |
Places subsequent lines in the output only if the expression in
the preceding #if or #elif directive
evaluates to false or is undefined (and hence the lines following the #if and preceding the #else have
been ignored).
Each test directive's condition is
checked in order. If it evaluates to false (0), the group that it controls
is skipped. Directives are processed only through the name that determines
the directive in order to keep track of the level of nested conditionals;
the rest of the directives' preprocessing tokens are ignored, as are the
other preprocessing tokens in the group. Only the first group whose control
condition evaluates to true (nonzero) is processed. If none of the conditions
evaluates to true, and there is a #else directive, the
group controlled by the #else is processed; lacking
a #else directive, all the groups until the #endif are skipped. |