A preprocessing directive consists of a sequence of preprocessing tokens
that satisfies the following constraints:
The first token in the sequence is a
#
preprocessing token that (at the start of translation phase 4)
is either the first character in the source file
(optionally after white space containing no new-line characters)
or that follows white space containing at least one new-line character.

The last token in the sequence is the first new-line character
that follows the first token in the sequence.146

A new-line character ends the preprocessing directive even if it occurs
within what would otherwise be an invocation of a function-like macro.

The only white-space characters that shall appear
between preprocessing tokens
within a preprocessing directive
(from just after the introducing
#
preprocessing token through just before the terminating new-line character)
are space and horizontal-tab
(including spaces that have replaced comments
or possibly other white-space characters
in translation phase 3).

the sequence of preprocessing tokens on the second line is not
a preprocessing directive, because it does not begin with a # at the start of
translation phase 4, even though it will do so after the macro EMPTY
has been replaced.

These “lines” have no other syntactic significance,
as all white space is equivalent except in certain situations
during preprocessing (see the
#
character string literal creation operator in [cpp.stringize], for example).

A defined-macro-expression evaluates to 1
if the identifier is currently defined
as a macro name
(that is, if it is predefined
or if it has been the subject of a
#define
preprocessing directive
without an intervening
#undef
directive with the same subject identifier), 0 if it is not.

The header or source file identified by
the parenthesized preprocessing token sequence
in each contained has-include-expression
is searched for as if that preprocessing token sequence
were the pp-tokens in a #include directive,
except that no further macro expansion is performed.

If such a directive would not satisfy the syntactic requirements
of a #include directive, the program is ill-formed.

The has-include-expression evaluates
to 1 if the search for the source file succeeds, and
to 0 if the search fails.

Each preprocessing token that remains (in the list of preprocessing tokens that
will become the controlling expression)
after all macro replacements have occurred
shall be in the lexical form of a token.

Prior to evaluation,
macro invocations in the list of preprocessing tokens
that will become the controlling constant expression
are replaced
(except for those macro names modified by the
defined
unary operator),
just as in normal text.

If the token
defined
is generated as a result of this replacement process
or use of the
defined
unary operator does not match one of the two specified forms
prior to macro replacement,
the behavior is undefined.

After all replacements due to macro expansion and
evaluations of defined-macro-expressions and
has-include-expressions
have been performed,
all remaining identifiers and keywords,
except for
true
and
false,
are replaced with the pp-number0,
and then each preprocessing token is converted into a token.

Thus on an
implementation where std​::​numeric_­limits<int>​::​max() is 0x7FFF
and std​::​numeric_­limits<unsigned int>​::​max() is 0xFFFF,
the integer literal 0x8000 is signed and positive within a #if
expression even though it is unsigned in translation phase
7.

—end note

]

This includes interpreting character literals, which may involve
converting escape sequences into execution character set members.

Whether the numeric value for these character literals
matches the value obtained when an identical character literal
occurs in an expression
(other than within a
#if
or
#elif
directive)
is implementation-defined.

If it evaluates to false (zero),
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;
any following groups are skipped and their controlling directives
are processed as if they were in a group that is skipped.

If none of the conditions evaluates to true,
and there is a
#elsedirective,
the group controlled by the
#else
is processed; lacking a
#else
directive, all the groups until the
#endifare skipped.148

searches a sequence of
implementation-defined
places
for a header identified uniquely by the specified sequence
between the
<
and
>
delimiters,
and causes the replacement of that
directive by the entire contents of the header.

How the places are specified
or the header identified
is implementation-defined.

The preprocessing tokens after
include
in the directive are processed just as in normal text
(i.e., each identifier currently defined as a macro name is replaced by its
replacement list of preprocessing tokens).
If the directive resulting after all replacements does not match
one of the two previous forms, the behavior is
undefined.149
The method by which a sequence of preprocessing tokens between a
<
and a
>
preprocessing token pair or a pair of
"
characters is combined into a single header name
preprocessing token is implementation-defined.

Although an implementation may provide a mechanism for making arbitrary
source files available to the < > search, in general
programmers should use the < > form for headers provided
with the implementation, and the " " form for sources
outside the control of the implementation.

Note that adjacent string literals are not concatenated into
a single string literal
(see the translation phases in [lex.phases]);
thus, an expansion that results in two string literals is an
invalid directive.

Two replacement lists are identical if and only if
the preprocessing tokens in both have
the same number, ordering, spelling, and white-space separation,
where all white-space separations are considered identical.

An identifier currently defined as an
object-like macro (see below) may be redefined by another
#define
preprocessing directive provided that the second definition is an
object-like macro definition and the two replacement lists
are identical, otherwise the program is ill-formed.

Likewise, an identifier currently defined as a
function-like macro (see below) may be redefined by another
#define
preprocessing directive provided that the second definition is a
function-like macro definition that has the same number and spelling
of parameters,
and the two replacement lists are identical,
otherwise the program is ill-formed.

If the identifier-list in the macro definition does not end with
an ellipsis, the number of arguments (including those arguments consisting
of no preprocessing tokens)
in an invocation of a function-like macro shall
equal the number of parameters in the macro definition.

Otherwise, there shall be at least as many arguments in the invocation as there are
parameters in the macro definition (excluding the ...).

There
shall exist a
)
preprocessing token that terminates the invocation.

defines a function-like macro
with parameters, whose use is
similar syntactically to a function call.

The parameters
are specified by the optional list of identifiers,
whose scope extends from their declaration in the identifier list
until the new-line character that terminates the
#define
preprocessing directive.

Each subsequent instance of the function-like macro name followed by a
(
as the next preprocessing token
introduces the sequence of preprocessing tokens that is replaced
by the replacement list in the definition
(an invocation of the macro).

The replaced sequence of preprocessing tokens is terminated by the matching
)
preprocessing token, skipping intervening matched pairs of left and
right parenthesis preprocessing tokens.

Within the sequence of preprocessing tokens making up an invocation
of a function-like macro,
new-line is considered a normal white-space character.

If there is a ... immediately preceding the ) in the
function-like macro
definition, then the trailing arguments (if any), including any separating comma preprocessing
tokens, are merged to form a single item: the variable arguments.

The number of
arguments so combined is such that, following merger, the number of arguments is
either equal to or
one more than the number of parameters in the macro definition (excluding the
...).

Since, by macro-replacement time,
all character literals and string literals are preprocessing tokens,
not sequences possibly containing identifier-like subsequences
(see [lex.phases], translation phases),
they are never scanned for macro names or parameters.

After the arguments for the invocation of a function-like macro have
been identified, argument substitution takes place.

For each parameter in the replacement list that is neither
preceded by a # or ## preprocessing token nor
followed by a ## preprocessing token, the preprocessing tokens
naming the parameter are replaced by a token sequence determined as follows:

The identifier __VA_­OPT__
shall always occur as part of the preprocessing token sequence
__VA_­OPT__(content),
where content is
an arbitrary sequence of preprocessing-tokens
other than __VA_­OPT__,
which is terminated by the closing )
and skips intervening pairs of matching left and right parentheses.

If content would be ill-formed
as the replacement list of the current function-like macro,
the program is ill-formed.

The preprocessing token sequence
__VA_­OPT__(content)
shall be treated as if it were a parameter,
and the preprocessing token sequence for the corresponding
argument is defined as follows.

If the substitution of __VA_­ARGS__ as neither an operand
of # nor ## consists of no preprocessing tokens,
the argument consists of
a single placemarker preprocessing token ([cpp.concat], [cpp.rescan]).

Otherwise, the argument consists of
the results of the expansion of content
as the replacement list of the current function-like macro
before removal of placemarker tokens, rescanning, and further replacement.

If, in the replacement list, a parameter is immediately
preceded by a
#
preprocessing token,
both are replaced by a single character string literal preprocessing token that
contains the spelling of the preprocessing token sequence for the
corresponding argument (excluding placemarker tokens).

Let the stringizing argument be the preprocessing token sequence
for the corresponding argument with placemarker tokens removed.

Each occurrence of white space between the stringizing argument's preprocessing
tokens becomes a single space character in the character string literal.

White space before the first preprocessing token and after the last
preprocessing token comprising the stringizing argument is deleted.

Otherwise, the original spelling of each preprocessing token in the
stringizing argument is retained in the character string literal,
except for special handling for producing the spelling of
string literals and character literals:
a
\
character is inserted before each
"
and
\
character of a character literal or string literal
(including the delimiting
"
characters).

If the replacement that results is not a valid character string literal,
the behavior is undefined.

The character string literal corresponding to
an empty stringizing argument is "".

If, in the replacement list of a function-like macro, a parameter is
immediately preceded or followed by a
##
preprocessing token, the parameter is replaced by the
corresponding argument's preprocessing token sequence; however, if an argument consists of no preprocessing tokens, the parameter is
replaced by a placemarker preprocessing token instead.153

For both object-like and function-like macro invocations, before the
replacement list is reexamined for more macro names to replace,
each instance of a
##
preprocessing token in the replacement list
(not from an argument) is deleted and the
preceding preprocessing token is concatenated
with the following preprocessing token.

Placemarker preprocessing tokens are handled specially: concatenation
of two placemarkers results in a single placemarker preprocessing token, and
concatenation of a placemarker with a non-placemarker preprocessing token results
in the non-placemarker preprocessing token.

If the result is not a valid preprocessing token,
the behavior is undefined.

If the name of the macro being replaced is found during this scan of
the replacement list
(not including the rest of the source file's preprocessing tokens),
it is not replaced.

Furthermore,
if any nested replacements encounter the name of the macro being replaced,
it is not replaced.

These nonreplaced macro name preprocessing tokens are no longer available
for further replacement even if they are later (re)examined in contexts
in which that macro name preprocessing token would otherwise have been
replaced.

The resulting completely macro-replaced preprocessing token sequence
is not processed as a preprocessing directive even if it resembles one,
but all pragma unary operator expressions within it are then processed as
specified in [cpp.pragma.op] below.

The preprocessing tokens after
line
on the directive are processed just as in normal text
(each identifier currently defined as a macro name is replaced by its
replacement list of preprocessing tokens).

If the directive resulting after all replacements does not match
one of the two previous forms, the behavior is undefined;
otherwise, the result is processed as appropriate.

__DATE__
The date of translation of the source file:
a character string literal of the form
"Mmm dd yyyy",
where the names of the months are the same as those generated
by the
asctime
function,
and the first character of
dd
is a space character if the value is less than 10.

If the date of translation is not available,
an implementation-defined valid date
shall be supplied.

__STDC_­MB_­MIGHT_­NEQ_­WC__
The integer literal 1, intended to indicate that, in the encoding for
wchar_­t, a member of the basic character set need not have a code value equal to
its value when used as the lone character in an ordinary character literal.

is processed as follows: The string literal is destringized
by deleting the L prefix, if present, deleting the leading and trailing
double-quotes, replacing each escape sequence \" by a double-quote, and
replacing each escape sequence \\ by a single
backslash.

The resulting sequence of characters is processed through translation phase 3
to produce preprocessing tokens that are executed as if they were the
pp-tokens in a pragma directive.

The original four preprocessing
tokens in the unary operator expression are removed.