This is the mail archive of the gcc-bugs@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: Possible variadic macro bug

[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


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