Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!rutgers!bellcore!tness7!tness1!sugar!ficc!peter From: peter@ficc.UUCP (Peter da Silva) Newsgroups: comp.lang.c Subject: Varibale (length) argument lists (Re: C vs. FORTRAN) Message-ID: <1037@ficc.UUCP> Date: 7 Jul 88 14:11:39 GMT References: <3136@phoenix.Princeton.EDU> <225800038@uxe.cso.uiuc.edu> <825@l.cc.purdue.edu> Organization: SCADA Lines: 28 In article <825@l.cc.purdue.edu>, cik@l.cc.purdue.edu (Herman Rubin) writes: > > I saw two methods: a 170 appends a zero word terminator to the argument > > list. A 205 passes the argument list length in the length field of > > argument list > > point. > The use of a zero terminator works because FORTRAN uses call by address, > and zero is not a legal address in FORTRAN. On some machines, zero cannot > be a legal address for anything, so it would work for all calls by address > in all languages. Fortran four-plus on the PDP-11 uses the illegal address -1 for missing arguments. This isn't exactly the same as a variable length argument list, but if you specify the list length as being large enough it can serve the same purpose. I used this to implement printf() in F4P, to ease the porting of 'C' programs to Ratfor (structures weren't a problem, since the programs involved had originally been written in a CP/M 'C' subset that didn't support them). DEC uses this to allow calls that look something like: CALL QIOW(FUN,UNIT,,,,PARMS) -- -- `-_-' Peter (have you hugged your wolf today) da Silva. -- U Ferranti International Controls Corporation. -- Phone: 713-274-5180. CI$: 70216,1076. ICBM: 29 37 N / 95 36 W. -- UUCP: {uunet,academ!uhnix1,bellcore!tness1}!sugar!ficc!peter.