Variable Parameters

Wm E. Davidsen Jr davidsen at sixhub.UUCP
Mon Jan 1 01:56:11 AEST 1990


henry at utzoo.uucp (Henry Spencer) writes:

| Your function has to have some way of knowing how many arguments there
| are, or which is the last argument.  

  I have wondered about this. B certainly had this, when I did my first
B port, about 15-18 years ago, the GCOS version called via a tsx7 and
generated an inline data block in the code which held (a) the number of
arguments, and (b) the address of the calling procedure name, to make
call trace easy.

  When I designed a language based on B, called IMP, it kept that
particular part of the implementation. It was later running on GCOS,
Varian620i, and Intel 8080 under both ISIS and CP/M. The procedure which
returned the number of args was called nargs().

  Where did that come from? I not only don't remember it in BCPL, I
just looked through my manual and don't find it (at least in the
index). If a portable varargs had been designed in at the start of the
language it would have saved a lot of future problems. Even nargs()
would help. I wonder if it was decided to leave it out of C, or if it
by oversight just never got in.

  Better to have C where a few things didn't get in, than PL/1 or Ada,
where everything got in.
-- 
	bill davidsen - sysop *IX BBS and Public Access UNIX
davidsen at sixhub.uucp		...!uunet!crdgw1!sixhub!davidsen

"Getting old is bad, but it beats the hell out of the alternative" -anon



More information about the Comp.lang.c mailing list