Can (or could) one suppress macro replacement in C by enclosing the name in brackets -
i seem recall 1 suppress replacement (expansion) of macro in c placing macro name in brackets, e.g. (free)(p)
call function free
whether or not macro free
defined. see no mention of in c99 standard (it there, see answer), , observe msvs 2013 not implement either. added in light of answer: does, standard requires, i.e. function-like macros, expansion triggered following ‘(
’ , inhibited intervening ‘)
’.
am dreaming, or there such possibility, , if so, rationale withdrawing it? or present in dialects?
a function-like macro foo
#define foo(x) ...
is expanded when token foo
appears followed (
token. thus, prevent expansion of foo
, (foo)
can used. said. applies function-like macros.
this specified in iso 9899:2011 §6.10.3 ¶10, reads:
10 preprocessing directive of 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-linedefines function-like macro parameters, use similar syntactically function call. parameters specified optional list of identifiers, scope extends declaration in identifier list until new-line character terminates #define preprocessing directive. each subsequent instance of function-like macro name followed ( next preprocessing token introduces sequence of preprocessing tokens replaced replacement list in definition (an invocation of macro). replaced sequence of preprocessing tokens terminated matching ) preprocessing token, skipping intervening matched pairs of left , right parenthesis preprocessing tokens. within sequence of preprocessing tokens making invocation of function-like macro, new-line considered normal white-space character.
Comments
Post a Comment