Date: Thu, 5 Feb 2004 21:04:56 +0100 From: Stefan Farfeleder <stefan@fafoe.narf.at> To: John Baldwin <john@baldwin.cx> Cc: arch@freebsd.org Subject: Re: C99 variadic macros Message-ID: <20040205200454.GD602@wombat.fafoe.narf.at> In-Reply-To: <200402051405.59533.john@baldwin.cx> References: <20040205164639.GC602@wombat.fafoe.narf.at> <200402051405.59533.john@baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040205200454.GD602>
