Is there a way to create a va_list
from scratch? I'm trying to call a function that takes a va_list
as a parameter:
func(void **entry, int num_args, va_list args, char *key);
...from a function that doesn't take a variable number of arguments. The only way I can think of is to create an intermediary function that takes varargs and then passing along its va_list, which is pretty stupid:
void stupid_func(void **entry, char *key, int num_args, ...) {
va_list args;
va_start(args, num_args);
func(entry, num_args, args, key);
va_end(args);
}
Is there a better way? I can't change func
's signature.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…