This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: problem with macro expansion in GCC
- To: 'David Korn' <dkorn at pixelpower dot com>, 'Puneet Singhal' <puneet at opussoft dot com>, gcc-help at gcc dot gnu dot org
- Subject: RE: problem with macro expansion in GCC
- From: Dhanabal Ekambaram <Dhanabal at Zambeel dot com>
- Date: Tue, 6 Feb 2001 10:32:06 -0800
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 ##.