Re: Variadic arguments to methods in Objective-C - How ?
Re: Variadic arguments to methods in Objective-C - How ?
- Subject: Re: Variadic arguments to methods in Objective-C - How ?
- From: James Bucanek <email@hidden>
- Date: Sat, 8 Jan 2005 13:26:55 -0700
Vincent Coetzee wrote on Saturday, January 8, 2005:
>How does one create methods in Objective-C that use a variable number
>of arguments. I am familiar with the normal C mechanism, but does this
>work in Objective-C considering the hidden arguments to methods (i.e.
>_self and _cmd) ? So can I use the normal C mechanism and if not how is
>it done ? Some sample code would be appreciated.
This is covered in the Obj-C language guide.
- (void)varArgMethod:(char*)firstArg, ...;
...
- (void)varArgMethod:(char*)firstArg, ...
{
va_list varList;
va_start(varList,firstArg);
...
x = va_arg(varList,sizeof(x);
...
...
[someObject varArgMethod:text,x,y,z];
--
James Bucanek <mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden