Hi, I have a method that takes one fixed parameter and then a variable number of parameters, the method is defined as:
-(void) methodX:(NSString*) theName,… The variable parameter list in this case can contain values of any type, e.g. an Object pointers, Integers, Floats etc, as in: NSString* myString; NSInteger myIntValue1; NSUInteger* myUIntValue1; CGFloat* myFloatValue; [myObj methodX:@"Name1",myString,myIntValue1,myUIntValue1,myFloatValue]; I've written code to work with variable parameter lists in the past, but previously, I always knew the expected size of the values at compile time, and they followed a fixed pattern, e.g. Obj*,Obj*,NSInteger, etc. But in this, the parameters can be in any order and any time, I do know the size of each parameter at *Run-Time*, e.g. I use "theName" parameter which is used to bring back a string of the types for a given name, for example, in the call: [myObj methodX:@"Name1",myString,myIntValue1,myUIntValue1,myFloatValue]; methodX would use "Name1" as a key to a dictionary which brings back the following in this case: NSString*,NSInteger,NSInteger,CGFloat, I can use this to figure out the length of the parameter in the method call, for example: NSString* 4 NSInteger 4 CGFloat 8 My problem is I can't figure out how to pass in this raw value to the "va_" functions/macros. See snippet below: -(void) methodX:(NSString*) theName,… { va_list myArgumentList; NSInteger myArgumentCount; myArgumentCount = 0; va_start(myArgumentList,theMethodName); while(va_arg(myArgumentList,NSString*) != nil) //******************** myArgumentCount++; va_end(myArgumentList); ……. ……. ……. } This is supposed to count the number of parameters, but will fail because it is assuming a size of 4 (NSString) in: va_arg(myArgumentList,NSString*) What I would like to be able to do is to pass in the raw value, something like, va_argWithSize(myArgumentList,4); I'm not sure how to do this or even if it is possible to do this? Any help or suggestions greatly appreciated. All the Best Dave _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com