This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Gcc3.4.2 C preprocessor problem
- From: "Dave Korn" <dk at artimi dot com>
- To: "'Andrew Walrond'" <andrew at walrond dot org>,<gcc at gcc dot gnu dot org>
- Date: Fri, 19 Nov 2004 16:18:35 -0000
- Subject: RE: Gcc3.4.2 C preprocessor problem
> -----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....