Varibale (length) argument lists (Re: C vs. FORTRAN)

Peter da Silva peter at ficc.UUCP
Fri Jul 8 00:11:39 AEST 1988


In article <825 at l.cc.purdue.edu>, cik at 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.



More information about the Comp.lang.c mailing list