This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Request to drop daft GNU extension
Martin v. Loewis wrote:-
> I'm in favour of dropping it, but I would really like to see the C99
> version as a replacement, not an ongoing support for the GNU macro
> varargs feature. If possible, the preprocessor should detect that a
> certain expansion has a different meaning under GNU C and C99, issue a
> warning, and use the C99 meaning. There should be an option to restore
> the GNU C meaning.
That's ongoing support, though, no? Or do you mean with the intent of
dropping it altogether in some later version?
>
> > #define eprintf(format, args...) fprintf (stderr, format , ## args)
>
> In C99, this would be written as
>
> #define eprintf(format, ...) fprintf (stderr, format __VA_ARGS__)
>
> Right?
Yes, if you're happy writing something like
eprintf ("string", )
for the empty case. Alternatively
#define eprintf(...) fprintf (stderr, __VA_ARGS__)
doesn't require that extra comma in the invocation. But then
eprintf()
is not a cpp error, and you'd have to wait for the front end to issue
an error.
Neil.