Re: Programmatically constructing list of variable arguments?
Re: Programmatically constructing list of variable arguments?
- Subject: Re: Programmatically constructing list of variable arguments?
- From: "Michael Ash" <email@hidden>
- Date: Fri, 12 Dec 2008 11:42:05 -0500
On Fri, Dec 12, 2008 at 9:41 AM, Jonathan del Strother
<email@hidden> wrote:
> Maybe an example would be helpful. Let's say I want to call
> -[Bartender mixCocktailIngredients:(NSString*)ingredient ...], and I
> want to call that with different arguments depending on the user's
> preferences.
> One way of doing so would be to use an if-statement, and just type out
> all the possibilities:
Why don't you just rewrite -mixCocktailIngredients: to take an NSArray
instead of variable arguments? Seems like that's ultimately what you
need anyway, so just change it to be more sane. If you really love
variable arguments then you can write a vararg version that calls
through to the NSArray version after marshaling the arguments.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden