You, Ben and Thad, make a distinction between a "function-like macro" and an
"object-like macro."
P.J. Plauger's exact wording on how this works (or is supposed to work):
"In the definition of a visible library function, the function name is
surrounded by parenthesis. ... Any such function can have its declaration
masked by a macro definition in its corresponding header. The parenthesis
prevent the translator from recognizing the macro and expanding it."
He makes no distinction between the two as far as I can tell. So, where
exactly do you get this?
Doesn't it seem clear to you that the statement you quoted above is
specifically about function names?
Somebody else cited a reference from C99, but it has to do with the
distinction between "ordinary" and "function-like" macros.
Ordinary macros are simple text replacement where the macro itself is
replaced by the specified text. This happens everywhere except in a
few specific contexts, such as inside a comment or quoted string, when
used with the "stringizing" preprocessor operator, or when it appears
recursively in its own expansion. Nothing other than the macro
identifier itself it replaced.
In function-like macros, the macro identifier itself is likely to be
replaced, but also parenthesized arguments that follow it. In other
words, the macro actually defines multiple identifiers that are
replaced on expansion.
Example:
#define SHOW_ERROR(err) fprintf(stderr, "Error = %d\n", (err))
Here the SHOW_ERROR macro not only generates replacement text for
itself when expanded, it also replaces the parameter 'err' with the
macro argument.
The C grammar for defining this type of macro requires that the
opening '(' be the first preprocessor token after the macro
identifier, meaning there can be nothing but white space characters in
between.
The requirement for the preprocessor to expand this macro is similar,
namely that the '(' preprocessor token immediately follow the macro
identifier. Putting the macro identifier in parentheses places a ')'
preprocessor token between the identifier and the '('.
Try it and see.
Also try:
#define X_PLUS_3 x + 3
#include <stdio.h>
int main(void)
{
int x = 0;
printf("%d\n", X_PLUS_3);
x = 10;
printf("%d\n", (X_PLUS_3));
return 0;
}
....and see what the parentheses do there.