This is the mail archive of the gcc@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]
Other format: [Raw text]

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....


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