varargs.h

jim at ISM780B.UUCP jim at ISM780B.UUCP
Mon Feb 25 16:29:59 AEST 1985


>/* Written  4:19 am  Feb 23, 1985 by ark at alice in ISM780B:net.lang.c */
>As the author of varargs, I would like to set the record straight.
>
>The intention of varargs was that the type given to va_arg
>should only be a type that is meaningful as a parameter.  Thus
>char, short, and float are never meaningful because they
>are automatically widened to int, int, and double respectively.
>/* End of text from ISM780B:net.lang.c */

There is nothing in the language that says that parameters cannot be
declared as char, short, or float.  And if typeof is (should be!)
added to the language, this will become all the more important.
Since sizeof is a compile-time constant, there is no reason why
va_arg cannot widen appropriately via ?: .  Of course, you will want an
ifdef lint version to avoid all the "constant used in a conditional context"
messages.  And speaking of lint, someone should fix it so it does not do
type checking against VARARGS parameters (or maybe we need a /*VARTYPE*/
comment?)

-- Jim Balter, INTERACTIVE Systems (ima!jim)



More information about the Comp.lang.c mailing list