• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: variadic variable argument list in #define
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: variadic variable argument list in #define (From: Ben Dougall <email@hidden>)

  • Prev by Date: Re: Making the correct button the default button?
  • Next by Date: Re: XML-RPC Framework and sending files
  • Previous by thread: Re: variadic variable argument list in #define
  • Next by thread: Re: variadic variable argument list in #define
  • Index(es):
    • Date
    • Thread