• 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: Ben Dougall <email@hidden>
  • Date: Tue, 10 Feb 2004 13:38:20 +0000

On Tuesday, February 10, 2004, at 03:31 am, b.bum wrote:

On Feb 9, 2004, at 4:30 PM, Ben Dougall wrote:
is it possible to use in obj-c code?

Yes.

http://www.pycs.net/bbum/2003/12/11.html



thanks very much for the link, but i still can't get it to work for some reason.

i've tried various different ways. here's i think the most likely to be correct attempt for the define:

#define f(...) function(__VA_ARGS__,NULL)

here's the macros use in the code:

f(1, 2, 3, 4)

and the function's decleration:

int function(unsigned firstVar, ... );

i'm trying to get the pre-processor to stick in ", NULL" after the variable arguments. and this is the error:

Compiling main.m (1 error, 4 warnings)
main.m:15:37: warning: __VA_ARGS__ can only appear in the expansion of a C99 variadic macro
main.m:15: `__VA_ARGS__' undeclared (first use in this function)
main.m:15: (Each undeclared identifier is reported only once
main.m:15: for each function it appears in.)
...

i've tried importing a few c .h files that look useful for variable arguements, but that hasn't made any difference either.

any ideas?

(this is in project builder 2.0.1 and gcc 3.1 in case that makes a difference -- using gcc 3.1 be the problem? from a quick google it looks like 3.1 should be ok with c99 but i could easily be wrong.)

thanks, ben.
_______________________________________________
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: "b.bum" <email@hidden>)

  • Prev by Date: Create an image Browser.
  • Next by Date: Re: exluding a window from Expose
  • Previous by thread: Re: variadic variable argument list in #define
  • Next by thread: Re: variadic variable argument list in #define
  • Index(es):
    • Date
    • Thread