varargs

Andrew Koenig ark at alice.UucP
Sun May 11 02:37:11 AEST 1986


> Hypothetical but quite beleivable:  On a 68000, pass the first N
> 32-bit integer (int, long, etc.) arguements in data regisers and the
> first M (32-bit) pointer arguments in address registers.  There isn't
> a typeof operator, and the hack of determining the data type by doing
> string manipulations on the quoted type, besides preprocessor
> replacements in quoted strings being a pcc oddity, breaks when faced
> with typedefs.  (I think argument quoting via a different meathod is
> proposed in the current ansi C draft.)
>
> This is true of any architecture with different register types with
> identical size.  (Otherwise the type could be determined by sizeof,
> which I do in the varargs.h implementation I wrote.)  Any proposted
> solutions, other than not having such a compiler on such a machine?

If a pointer argument is passed in a different place from an
integer argument of the same size, then implementing varargs
requires some help from the compiler.

But such an implementation is going to have trouble in any event
because even today there are sometimes programs that forget to,
say, declare the type of an argument.  This is especially true
when that argument is merely passed to some other function.



More information about the Comp.unix.wizards mailing list