Yes. You are right.
----- Original Message -----
From: "Andreas Schwab" <[EMAIL PROTECTED]>
To: "Michael Gong" <[EMAIL PROTECTED]>
Cc: "Jan Beulich" <[EMAIL PROTECTED]>; <gcc@gcc.gnu.org>
Sent: Monday, September 25, 2006 12:08 PM
Subject: Re: preprocessing question
"Michael Gong" <[EMAIL PROTECTED]> writes:
One explanation could be:
----- Original Message -----
From: "Jan Beulich" <[EMAIL PROTECTED]>
To: <gcc@gcc.gnu.org>
Sent: Monday, September 25, 2006 11:23 AM
Subject: preprocessing question
Can anyone set me strait on why, in the following code fragment
int x(unsigned);
struct alt_x {
unsigned val;
};
#define x alt_x
#define alt_x(p) x(p+1)
since "x" is already defined as a object-like macro, "x" is replaced by
"alt_x", so this essentially is: #define alt_x(p) alt_x(p+1)
Since C99 (6.10.3.9) describes:
... defines an object-like macro that causes each subsequent instance of
the macro name to be replaced by the replacement list of preprocessing
tokens that constitute the remainder of the directive.
Macro expansion does not operate on preprocessing directives unless noted
otherwise.
Andreas.
--
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."