Re: variadic variable argument list in #define
Re: variadic variable argument list in #define
- Subject: Re: variadic variable argument list in #define
- From: "b.bum" <email@hidden>
- Date: Tue, 10 Feb 2004 10:54:44 -0800
On Feb 10, 2004, at 9:48 AM, Ben Dougall wrote:
On Tuesday, February 10, 2004, at 04:44 pm, Marten van Gelderen wrote:
Hello Ben,
Try (right from the Cocoa docs):
#define myDebug(format, args...) fprintf(stderr, format, args)
Martin, yup you're right. now works fine. in my case it was:
#define f(args...) function(args,NULL)
but the main thing was 'args...' and 'args', not '...' and
'__VA_ARGS__'.
thanks very much, ben.
To answer your prior question, yes -- it is a c99 thing and is enabled
by default in GCC 3.3. For gcc 3.1, the '-std=c99' flag should enable
support for variadic macros, but I haven't double-checked that it
really does.
The solution that Marten provided works, but is a GCC specific
extension that is non-standard. So, if portability is important, you
would probably want to use the other form.
http://gcc.gnu.org/onlinedocs/gcc/Variadic-Macros.html
b.bum
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.