This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Possible variadic macro bug
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Subject: Re: Possible variadic macro bug
- From: seebs at plethora dot net (Peter Seebach)
- Date: Tue, 13 Nov 2001 15:24:55 -0600
- Cc: Zack Weinberg <zack at codesourcery dot com>, gcc-bugs at gcc dot gnu dot org
- Reply-to: seebs at plethora dot net (Peter Seebach)
[Get raw message]
[Get raw message]
Just a side question:
If the spec were some day revised to say that
#define foo (a, ...) bar(a, __VA_ARGS__)
foo(a)
foo(b, c)
produced
bar(a)
bar(b, c)
would this be a big problem for gcc? Essentially, this removes the ## before
the comma, and is otherwise (so far as I can tell) equivalent to what you're
doing. We have draft wording floating around that would allow the ", ..." to
be ommitted in calls to variadic macros.
The reason I ask is that a couple of people have objected to the ", ##" as
being ugly (which I grudgingly grant that it is), and it seems to me that
the above change cannot break any currently-conforming code, and always does
what the user meant. The formal wording would state that a comma preceeding
__VA_ARGS__ is omitted if __VA_ARGS__ is empty. I don't think anyone ever
wants the comma in that case.
When this gets written up, I'd like to present both alternatives, in the hopes
of increasing the chance that *something* gets done. I'd sort of prefer the
existing GNU C solution in terms of prior art, but I don't really like the
visual effect of ",##".
-s