passing variable numbers of arguments

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jan 7 20:16:02 AEST 1989


In article <899 at thor.stolaf.edu> edf at rocky2.rockefeller.edu writes:
>The following program produces unexpected results:
>foo (va_alist)
>  va_dcl
>{
>  bar (va_alist);
>}

No wonder!  The only proper way to pass a variable argument list
down another level is to pass an initialized va_list object.
The bar() function cannot be called both with variable arguments
AND with a single va_list argument.

Check out the specs for vfprintf() and friends to see how this
approach works.



More information about the Comp.lang.c mailing list