Variable length argument list handling

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Aug 19 07:50:51 AEST 1989


In article <1441 at esunix.UUCP> bjones at esunix.UUCP (Ben Jones) writes:
-Question:  Why can't a C function which allows a  variable  number  of
-arguments find out how many arguments were actually passed?  ...
-ANSI C does not change any of the function  calling  conventions.   It
-cannot  or  else existing function libraries would be invalidated when
-switching to ANSI C.

You answered your own question.

-Therefore, it would appear that the best way to get  the  length of
-the argument list is to add a new reserved word to the language to
-handle variable parameter lists.

X3J11 thought that the best way was to give a function that needed
that information an extra parameter containing it, when you design
its interface.



More information about the Comp.lang.c mailing list