Variable argument lists.
Lawrence V. Cipriani
lvc at tut.cis.ohio-state.edu
Wed May 11 12:37:16 AEST 1988
In article <3569 at ece-csc.UUCP>, jnh at ece-csc.UUCP (Joseph Nathan Hall) writes:
> 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?
*
* That's because in theory one of the "fixed" arguments in your function's
* argument list should indicate, either directly with a count, or indirectly
* (like printf), how many arguments follow in the variable-length portion
* of the argument list.
*
Nope. For example, it is perfectly legal to have:
p = cat(s1, s2, ..., sn, (char *)0); /* pseudo C */
where all the si are strings. There is no count passed, and there
is not a printf like format argument. cat() can be called with
however many strings (si) you want, even 0.
--
Larry Cipriani, AT&T Network Systems and Ohio State University
Domain: lvc at tut.cis.ohio-state.edu
Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)
More information about the Comp.lang.c
mailing list