Function with variable number of args

jeff at AIDS-UNIX.ARPA jeff at AIDS-UNIX.ARPA
Tue Jun 26 10:15:20 AEST 1984


From:  Jeff Dean <jeff at AIDS-UNIX.ARPA>

(flame on)

I disagree that with the idea that handling a "maximum number of
arguments" is the same as handling a variable number of arguments.
Sure, if you make the number large enough, people are unlikely to
run into the limit, but that's not the point.  You need a dynamic
mechanism to handle a variable number of arguments; the "maximum
number of arguments" is a static method, and insufficient.

A variable argument mechanism needs to provide at least two
things:  to subroutine users, it allows an arbitrary number of
arguments (subject to hardware constraints, such as stack size);
to subroutine implementors, it means having a uniform mechanism
for dealing with an unlimited number of arguments (and not having
to guess at the maximum number of arguments any users are likely
to throw at you).

(flame off)



More information about the Comp.unix.wizards mailing list