varargs macros and ##
Bruce Korb
bkorb@sco.COM
Wed May 17 12:01:00 GMT 2000
Zack Weinberg wrote:
> # It might be better to discard the last preprocessor token instead
> # of the last preceding sequence of non-whitespace characters; in
> # fact, we may someday change this feature to do so. We advise you...
>
> .... Now, it happens that I
> am reimplementing macro expansion, and it will be much easier for the
> reimplementation to discard the last preprocessor token. It's my
> opinion that it is definitely better to do so; the behavior is less
> surprising to the user, and much more likely to be what they wanted.
>
> Does anyone object to my changing this behavior?
Do it. If it ever gets into a C spec someday, it will certainly
be this behavior, and not the non-whitespace-gobbling behavior!
Unless, of course, it is constrained to only gobbling a single
comma. There really is not any need to gobble anything else. :-)
With such a constraint:
#define foo( x... ) ....
becomes usable. (I am aware of the lack of symmetry with the
procedure header. :)
More information about the Gcc
mailing list