Gcc3.4.2 C preprocessor problem
Dave Korn
dk@artimi.com
Fri Nov 19 16:28:00 GMT 2004
> -----Original Message-----
> From: gcc-owner On Behalf Of Andrew Walrond
> Sent: 19 November 2004 16:15
> Given this macro:
>
> #define PRESENT_OR_SET_GENERIC(xxx) \
> if (!drawops. ## xxx) \
> drawops. ## xxx = generic_ ## xxx;
>
> this line:
>
> PRESENT_OR_SET_GENERIC(draw_hline);
>
> gives this error when compiled
>
> gcc -c -o init.o init.c
> init.c:59:1: pasting "." and "draw_hline" does not give a
> valid preprocessing
> token
>
> Is this a bug, or some change of behaviour I am unaware of?
Your code is buggy. Preprocessor pasting concatenates two tokens into one
single one. But you want the . operator to be a separate token from the
struct member. Just omit the pasting and you'll be fine.
> It used to work
> fine with previous compiler versions.
That would have been buggy of the compiler.
cheers,
DaveK
--
Can't think of a witty .sigline today....
More information about the Gcc
mailing list