This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Varargs macros subtly broken
- To: Neil Booth <NeilB at earthling dot net>
- Subject: Re: Varargs macros subtly broken
- From: Jamie Lokier <egcs at tantalophile dot demon dot co dot uk>
- Date: Wed, 27 Sep 2000 18:02:35 +0200
- Cc: Zack Weinberg <zackw at Stanford dot EDU>, gcc at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- References: <E13dHl8-0005rl-00@kings-cross.london.uk.eu.org> <20000924225710.A12825@pcep-jamie.cern.ch> <20000924171436.F28755@wolery.stanford.edu> <20000925184254.A14482@pcep-jamie.cern.ch> <20000925224320.J6182@wolery.stanford.edu> <20000926125627.B17752@pcep-jamie.cern.ch> <20000926232108.A15334@daikokuya.demon.co.uk> <20000927014103.A20431@pcep-jamie.cern.ch> <20000927071631.A15948@daikokuya.demon.co.uk>
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