• 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: Programmatically constructing list of variable arguments?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Programmatically constructing list of variable arguments? (From: "Jonathan del Strother" <email@hidden>)
 >Re: Programmatically constructing list of variable arguments? (From: "Kyle Sluder" <email@hidden>)
 >Re: Programmatically constructing list of variable arguments? (From: "Kyle Sluder" <email@hidden>)
 >Re: Programmatically constructing list of variable arguments? (From: "Jonathan del Strother" <email@hidden>)

  • Prev by Date: Re: Design for showing ridiculously huge number of images in Table View
  • Next by Date: Re: Looking for info on creating Plugins/Modules
  • Previous by thread: Re: Programmatically constructing list of variable arguments?
  • Next by thread: Re: Programmatically constructing list of variable arguments?
  • Index(es):
    • Date
    • Thread