This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: problem with macro expansion in GCC


Hi David & Puneet,

Thanks for the comments.

I did try with concatenation already. It takes care of
the space between "N" and the ".".  But, I do get
a leading space wherever I use this macro.

If I have 
x = a.XXX(b);

I expect it to change to
x = a.b.ptr;

but, it changes to
x = a. b.ptr;

Thanks,
dhanabal

>   What happens if you try
>#define XXX(N) N ## .ptr  
>
> or perhaps
>
>#define CAT(a, b) a ## b
>#define XXX(N)    CAT(N, .ptr)
> 
>  One or other of those should work.  You can't ask macros to concatenate
>two strings just by writing them next to each other, you have to use
>the pre-processor pasting command ##.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]