stdarg

Erik Naggum enag at ifi.uio.no
Thu Feb 7 09:06:58 AEST 1991


In article <1991Feb6.171144.7182 at Neon.Stanford.EDU>, Dave Eisen writes:
> In article <588 at taumet.com>, Stephen Clamage writes:
>> In article <id_destroyed_by_Stephen_Clamage>, Paul Elliott writes:
>>> In ansi C, is there a way to have a function with a variable argument list
>>> and zero fixed parameters? If so what would one use for the second parameter
>>> to va_start, which is normally supposed to be the last fixed parameter?
>
>> Not in ANSI C.  The <stdarg.h> method requires at least one fixed argument.
>
> Probably a reasonable decision. But it does make it a pain to deal
> with the third party software we use that is full of <varargs.h> functions
> that can take 0 or more arguments.

How do these functions determine how many arguments to use, and what
type they are?

My experience (although limited with "third party software"), is that
<varargs.h>-based functions only appear to have "0 or more arguments",
since the first thing they do is to get the arguments that are of
known type, including some "format specifier" or other "argument type
and count list".  Is this not so?

I found ANSI X3J11's decision to make the first argument of known type
very wise.  In fact, the whole <stdarg.h> thing is pretty nifty.

--
[Erik Naggum]					     <enag at ifi.uio.no>
Naggum Software, Oslo, Norway			   <erik at naggum.uu.no>



More information about the Comp.lang.c mailing list