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

12 Preprocessor Directives and Macros
The preprocessor is a macro processor that processes the source text of a program before the
compiler parses the program.
The preprocessor is controlled by preprocessor directive lines that appear in your source text.
Preprocessor directive lines always begin with a number sign (#) in column one. The name of the
directive follows the number sign. The remainder of the line can contain arguments for the directive.
Table 25 summarizes the preprocessor directives.
Table 25 Preprocessor Directives
Defines a preprocessor macro and defines an identifier as the macro name.#define
Conditionally includes text, depending on the value of a constant expression.#elif
Conditionally includes text if the test on the related #if, #elif, #ifdef, or #ifndef
directive fails.
#else
Terminates conditional text.#endif
Forces a compilation error and terminates compilation.#error
Conditionally includes text, depending on the value of a constant expression.#if
Conditionally includes text, depending on whether an identifier is currently defined as a
macro name.
#ifdef
Conditionally includes text, depending on whether an identifier is currently undefined as
a macro name.
#ifndef
Replaces the directive with the contents of a specified file.#include
Causes the compiler to renumber the lines in the source text.#line
Introduces a compiler pragma.#pragma
Deletes a macro definition.#undef
#define
The #define directive defines a macro, providing it with a name (an identifier) and the replacement
list that the name represents. The macro can be either object-like or function-like, depending on
how you define it.
#define { object-like-name } replacement-list newline
{ function-like-name }
object-like-name:
identifier
function-like-name:
identifier( [parameter-list] )
object-like-name
specifies the name of an object-like macro; it must be a valid identifier.
function-like-name
specifies the name and parameters (if any) of a function-like macro. The parameter list is a
parenthesized, comma-separated list of zero or more identifiers. Note that there can be no
white space between the macro identifier and the opening parenthesis of the parameter list.
#define 153