Variable argument lists.

Brian T. Schellenberger bts at sas.UUCP
Sat May 14 06:06:16 AEST 1988


In article <14139 at brl-adm.ARPA> bates%falcon.dnet%fermat at bru.mayo.edu (Cary Bates) writes:
|       Does anybody know (or care) why in ANSI standard C when 
|       using a variable length argument list, there is no way to 
|       determine how many arguments where passed into the function?
|       Without such a feature it seems to me that the most of the 
|       power of the variable argument list is wasted.

Because it is not possible to do so on many architectures, including lots of
Unices.  In fact, it is not possible to determine this information with the
standard Unix varargs, either.  And printf et al have gotten along for years
without the capability.

K&R (orig) say:

printf, the most common C function with a variable number of arguments,
uses information from the first argument to determine how many arguments
are present . . . It fails badly if the caller does not supply enough
arguments.

So, in short, if VMS supplies this capablity, enjoy it.  But the rest of the 
world has gotten along without it all these years, and seems to have survived 
just fine.  Thus, I seriously doubt that it "most of the power of the
variable argument list is wasted."
-- 
 _______________________                             __Brian___________________
|Brian T. Schellenberger| "The Earth is but one     | ...!mcnc!rti!sas!bts     |
|104 Willoughby Lane    | country, and Mankind its  |work: (919) 467-8000 x7783|
|Cary, NC   27513       | citizens" --Baha'u'llah   |home: (919) 469-9389      |



More information about the Comp.lang.c mailing list