Re: C99 variadic macros
From: John Baldwin (jhb_at_FreeBSD.org)
Date: 02/05/04
- Previous message: Stefan Farfeleder: "Re: C99 variadic macros"
- In reply to: Stefan Farfeleder: "Re: C99 variadic macros"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: Stefan Farfeleder <stefan@fafoe.narf.at> Date: Thu, 5 Feb 2004 15:44:48 -0500
On Thursday 05 February 2004 03:04 pm, Stefan Farfeleder wrote:
> 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.
Not always easily done in my experience, though the 3 printf thing (ugh) might
serve as a workaround as I didn't try that before when I've tried to use the
C99 way.
-- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org _______________________________________________ freebsd-arch@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-arch To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
- Previous message: Stefan Farfeleder: "Re: C99 variadic macros"
- In reply to: Stefan Farfeleder: "Re: C99 variadic macros"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]