If the function was defined with a prototype that explicitly specified parameter types, for example.
void somefunc(int arg1, float arg2);
but implemented as
void somefunc(int arg1, ...) { ... }
Can va_arg be used to get a float? This usually prevents this, because varargs functions have implicit type promotions such as float to double, so trying to get a nonprotected type is not supported, although the function is called using a nonprotected type for a more specific function prototype.
The reason for this is to extract arguments of different types at run time, as part of the obj-c interpreter, where one function will be reused for all different types of methods.
This would be best since the architecture would not be independent (so if not the same code works on the simulator and on the device), although if there is no way to do this, specific corrections will be made for the specific device.
EDIT: forgot to mention specifically: the function knows the types and number of arguments (it looks at the code that needs to be interpreted using a map search using the SEL _cmd parameter)
source
share