The va_arg
macro's second argument is the actual type of the actual argument. No conversion takes place as a result of the va_arg
invocation. If you don't know the actual type of the actual argument, you're out of luck because there is no way to find out.
Note that default argument conversions do take place in the call itself, so it is impossible to receive a float
, char
or unsigned short
. (The float
will be converted to double
and the other two to int
or unsigned int
, depending.)
This is why printf
formats make you specify the type of the argument, except for float
.