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]

Re: Varargs macros subtly broken


Neil Booth wrote:
>> *boggle* you mean this is broken even without varargs?  Ouch!
>
>No, only in the varargs case.

Ah, I see.  Here is my simplified test case, probably like yours:

  #define half(x)      ((x) / 2)
  #define apply(...)   apply2 (__VA_ARGS__)
  #define apply2(f,x)  f (x)

  apply (half, X)

Expands to `half (X)' when it should expand to `((X) / 2)'.

-- Jamie

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