I can reinforce Bill's advice here. I tried to do this same thing once, fairly recently actually, so that I could subclass a Foundation class that had a variadic init method. I lost several hours of my time and a lot of my sanity trying to find a way to make it work before giving up.

On Jan 13, 2009, at 11:48 AM, Bill Bumgarner wrote:

On Jan 13, 2009, at 8:32 AM, Horst Jäger wrote:
I have a problem concerning the va_list. I don't know how to programaticly create one.

I need to do this because I want to use the initWithFormat method of NSString. But I neither know how many args there will be nor are the args Strings - they are selectors the associated methods of which return Strings.

... rest of excellent problem description deleted ...

In short, you don't want to do this. Specifically, creating a vaargs list to be passed as a parameter to another method effectively requires encoding the arguments in whatever fashion the compiler would encode them. It is highly architecture specific and is rife with really awesomely tedious details that are easy to screw up.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to