Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!crdgw1!sixhub!davidsen From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr) Newsgroups: comp.lang.c Subject: Re: Variable Parameters Message-ID: <363@sixhub.UUCP> Date: 31 Dec 89 14:56:11 GMT References: <1169@zip.eecs.umich.edu> <1989Dec31.013746.2349@utzoo.uucp> Reply-To: davidsen@sixhub.UUCP (bill davidsen) Organization: *IX Public Access UNIX, Schenectady NY Lines: 30 henry@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@sixhub.uucp ...!uunet!crdgw1!sixhub!davidsen "Getting old is bad, but it beats the hell out of the alternative" -anon