C99 variadic macros
Stefan Farfeleder
stefan at fafoe.narf.at
Thu Feb 5 12:06:15 PST 2004
On Thu, Feb 05, 2004 at 02:05:59PM -0500, John Baldwin wrote:
> On Thursday 05 February 2004 11:46 am, Stefan Farfeleder wrote:
> > #define foo(fmt, args...) printf("%s: " fmt "\n", __func__, ##args)
> C99 macros don't work when args is 0. I.e., if I did:
>
> foo("test");
>
> The C99 _VA_ARGS_ think doesn't delete the , whereas the GCC way does.
While it's true that the ellipsis must match a positive number of
arguments, this isn't necessarily a problem. You just use "..." for
both the format string and its arguments.
Cheers,
Stefan Farfeleder
More information about the freebsd-arch
mailing list