HELP!! arg-lists in Turbo-C

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Oct 19 19:19:03 AEST 1989


In article <19724 at ut-emx.UUCP> readdm at walt.cc.utexas.edu (David M. Read) writes:
>I am trying to write a variable-length arg-list processor in
>Turbo-C, and for special reasons I can't use the stuff supplied
>in <stdarg.h>.

It would be interesting to hear why, since that's the only official way
to get at variadic arguments.

>This indicates that floats are pushed onto the stack as type double, no?

Variadic arguments always have the default argument promotions applied,
so yes, a float argument appears as a double to va_arg().

>The trick is this: I need to BUILD a va_list, not analyze one.

The only official way to build a variadic argument list is to invoke
a function whose type was declared using the ,...) notation.

If you devise some other kludge, it is subject to breakage without
notice in future compiler releases, or when porting to another
implementation.



More information about the Comp.lang.c mailing list