• 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: Clark Cox <email@hidden>
  • Date: Mon, 9 Feb 2004 20:58:13 -0500

On 2004/02/09, at 20:34, Jens Bauer wrote:

> Hi Ben (and others)
>
> On Tuesday, Feb 10, 2004, at 01:30 Europe/Copenhagen, Ben Dougall
> wrote:
>
>> i'd like to use a variable argument list in a #define macro just like
>> what's at the start of the above linked to page, but when i use it
>> like this for example:
>>
>> #define mf(...) myfunction(__VA_ARGS__,NULL)
>
> I claimed that you need at least one argument, this is uhm not
> correct. =)
> Sorry for my mistake. ;)
>
> -But that's because I confused it with function declarations in C.
>
> Try out the example from my page. This works on Project Builder with
> GCC >= 2.9, it should also work with CodeWarrior and even MPW.

Except that the example on your site is a GCC extension, it is not
standard C. From the C99 standard:

In section 6.10.3:

"10 A preprocessing directive of the form
#define identifier lparen identifier-listopt ) replacement-list new-line
#define identifier lparen ... ) replacement-list new-line
#define identifier lparen identifier-list , ... ) replacement-list
new-line"

--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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: Jens Bauer <email@hidden>)

  • Prev by Date: Re: Localizable.strings *just stop working*
  • Next by Date: Re: Drawing onto NSImageView subclass (Newbie)
  • Previous by thread: Re: variadic variable argument list in #define
  • Next by thread: Re: variadic variable argument list in #define
  • Index(es):
    • Date
    • Thread