Previous Table of Contents "New C Standard" commentary
1918 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 shall not be
redefined by another
Likewise, an identifier currently defined as a function-like macro
shall not be redefined by another
1921 There shall be white-space between the identifier and the replacement list in the definition of an object-like macro.
1922 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 more arguments in the invocation than there
are parameters in the macro definition (excluding the
There shall exist a
1926 A parameter identifier in a function-like macro shall be uniquely declared within its scope.
The identifier immediately following the
1928 There is one name space for macro names.
1929 Any white-space characters preceding or following the replacement list of preprocessing tokens are not considered part of the replacement list for either form of macro.
1931 A preprocessing directive of the form
# define identifier replacement-list new-line
defines an object-like macro that causes each subsequent instance of the macro name146) to be replaced by the replacement list of preprocessing tokens that constitute the remainder of the directive.
1933 A preprocessing directive of the form
# define identifier lparen identifier-listopt ) replacement-list new-line # define identifier lparen ... ) replacement-list new-line # define identifier lparen identifier-list , ... ) replacement-list new-line
defines a function-like macro with
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
Each subsequent instance of the function-like macro name followed by
The replaced sequence of preprocessing tokens is terminated by the
1937 Within the sequence of preprocessing tokens making up an invocation of a function-like macro, new-line is considered a normal white-space character.
1938 The sequence of preprocessing tokens bounded by the outside-most matching parentheses forms the list of arguments for the function-like macro.
1939 The individual arguments within the list are separated by comma preprocessing tokens, but comma preprocessing tokens between matching inner parentheses do not separate arguments.
If there are sequences of preprocessing tokens within the list of
arguments that would otherwise act as preprocessing
If there is a
The number of arguments so combined is such that, following merger,
the number of arguments is one more than the number of parameters in
the macro definition (excluding the
1943 146) Since, by macro-replacement time, all character constants and string literals are preprocessing tokens, not sequences possibly containing identifier-like subsequences (see 184.108.40.206, translation phases), they are never scanned for macro names or parameters.
Created at: 2008-01-30 02:39:45
The text from WG14/N1256 is copyright © ISO
Created at: 2008-01-30 02:39:45 The text from WG14/N1256 is copyright © ISO