Possible variadic macro bug

Neil Booth neil@daikokuya.demon.co.uk
Fri Nov 2 14:23:00 GMT 2001


Zack Weinberg wrote:-

> On Tue, Nov 13, 2001 at 10:21:47PM +0000, Neil Booth wrote:
> > 
> > I agree with Clive Feather's point that the use of ## is ugly because
> > it gives 2 meanings to ##; I said as much over a year ago when this
> > was discussed.  So I'm in favour of a clean replacement.  I didn't
> > like any of his three suggestions at all, though.
> 
> Do you have a reference to what he said?

No, it's on one of the reflectors, which are for some reason non-public,
but I've managed to get subscribed.  He wrote (amongst other things):

<<<
During the C9X process there were some proposals to address this. I can't
find them off the top of my head, but I seem to recall:
                                                       
    __VA_IF__(arg)     expands to arg if __VA_ARGS__ is not empty
    __VA_COMMA__       expands to a comma, but doesn't separate argumetns
    __VA_COUNT__       expands to the number of arguments in __VA_ARGS__ 

You'd write __VA_IF__(__VA_COMMA_ __VA_ARGS__) for your ", ## __VA_ARGS__".
>>>

Neil.



More information about the Gcc-bugs mailing list