In that case, you can use 'va_copy', which is a portable macro. Then
Yes, it is true, but:
$gcc -W -Wall -ansi -pedantic test4.c
test4.c:43:3: warning: implicit declaration of function ‘va_copy’
[-Wimplicit-function-declaration]
/tmp/ccwjg0Bw.o: In function `bar':
test4.c
.text+0x2cf): undefined reference to `va_copy'
'va_copy' is available from C99.
I'm looking solution for C89.
C89 doesn't allow for a function with a 'va_list' parameter to pass that
parameter to yet another function. It also doesn't specify anything
about the 'va_list' type other than that it's a "type suitable for
holding information need by the macros va_start, va_arg, va_end." It is
also known to be an object type, because it states that 'ap' is an
object. But because it could be an array type, a 'va_list' parameter
could be either the same type as a 'va_list' declared outside of a
function parameter list, or it could be a different type.
The biggest problem I see with trying to make a pre-C89 'va_copy' or
with trying to code a work-around so that you can work with 'ap' at any
depth of call is that 'va_list' could be a const-qualified type, so you
can't portably modify it.
Having said that, I don't yet know if it's impossible.
Is it really a major pain to do all your 'va_arg' work in the function
with the 'va_list' parameter?