#define xalt_x
>
>the preprocessor token "x" is an object-like macro standing for "alt_x", so
>when we get to
>
#define alt_x(p) x(p+1)
>
> what the preprocessor sees after the first round of expansion is
>
>#define alt_x(p) alt_x(p+1)
As pointed out before - there is *no* expan
Jan Beulich wrote:-
> Can anyone set me strait on why, in the following code fragment
>
> int x(unsigned);
>
> struct alt_x {
> unsigned val;
> };
>
> #define xalt_x
> #define alt_x(p) x(p+1)
>
> int test(struct x *p) {
> return x(p->val);
> }
>
> the function invoked in t
On 26 September 2006 08:43, Jan Beulich wrote:
Daniel Jacobowitz <[EMAIL PROTECTED]> 25.09.06 18:43 >>>
>> On Mon, Sep 25, 2006 at 05:23:34PM +0200, Jan Beulich wrote:
>>> Can anyone set me strait on why, in the following code fragment
>>>
>>> int x(unsigned);
>>>
>>> struct alt_x {
>>>
"Jan Beulich" <[EMAIL PROTECTED]> writes:
> While, as Andreas also pointed out, the standard is a little vague in
> some of what it tries to explain here, it is in my opinion clearly said
> that the re-scanning restrictions are bound to the macro name, not
> the fact that a function-like macro's e
>>> Daniel Jacobowitz <[EMAIL PROTECTED]> 25.09.06 18:43 >>>
>On Mon, Sep 25, 2006 at 05:23:34PM +0200, Jan Beulich wrote:
>> Can anyone set me strait on why, in the following code fragment
>>
>> int x(unsigned);
>>
>> struct alt_x {
>> unsigned val;
>> };
>>
>> #define xalt_x
>> #d
Daniel Jacobowitz <[EMAIL PROTECTED]> writes:
> On Mon, Sep 25, 2006 at 05:23:34PM +0200, Jan Beulich wrote:
>> Can anyone set me strait on why, in the following code fragment
>>
>> int x(unsigned);
>>
>> struct alt_x {
>> unsigned val;
>> };
>>
>> #define xalt_x
>> #define alt_x(p
On Mon, Sep 25, 2006 at 05:23:34PM +0200, Jan Beulich wrote:
> Can anyone set me strait on why, in the following code fragment
>
> int x(unsigned);
>
> struct alt_x {
> unsigned val;
> };
>
> #define xalt_x
> #define alt_x(p) x(p+1)
>
> int test(struct x *p) {
> return x(p->
Yes. You are right.
- Original Message -
From: "Andreas Schwab" <[EMAIL PROTECTED]>
To: "Michael Gong" <[EMAIL PROTECTED]>
Cc: "Jan Beulich" <[EMAIL PROTECTED]>;
Sent: Monday, September 25, 2006 12:08 PM
Subject: Re: preprocessing quest
The output with cpp 4.0.3:
int test(struct alt_x *p) {
return alt_x(p->val+1);
}
It seems that:
1) "x" expands to alt_x
2) "alt_x(p->val)" expands to "x(p->val+1)"
3) "x" expands (again!) to alt_x
or maybe something else?
"Michael Gong" <[EMAIL PROTECTED]> writes:
> One explanation could be:
>
> - Original Message -
> From: "Jan Beulich" <[EMAIL PROTECTED]>
> To:
> Sent: Monday, September 25, 2006 11:23 AM
> Subject: preprocessing question
>
>
>> Can anyone set me strait on why, in the following code frag
One explanation could be:
- Original Message -
From: "Jan Beulich" <[EMAIL PROTECTED]>
To:
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;
};
#d
11 matches
Mail list logo