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 **e
This is a bad idea because the va_list abstraction is there to hide some grim compiler/architecture specific details regarding stack-pointers and what not. And it is pretty much bound to the function's scope once initialized. If you wind the stack and reference a previous frames va_args out of scope, things can go bad. You can pass them around but ...
expect bugs
See: http://lists.freebsd.org/pipermail/freebsd-amd64/2004-August/001946.html
Also checkout man(3) va_copy and friends for safer handling of va_args and passing them around.
IMHO the va_args stuff is not very neat. In the past I have dealt with this by initializing structures/opaque pointers on the heap then using pointer arithmetic to work the data. But this is a hack and depends on circumstances.