[comp.lang.c] Fortran arguments

chris@mimsy.UUCP (Chris Torek) (12/26/87)

In article <2068@ttrdc.UUCP>, levy@ttrdc.UUCP (Daniel R. Levy) writes:
>UNIX f77 uses pass-by-address for FORTRAN parameter passing, but still
>implements a copy-in copy-out scheme where this would make a difference
>(i.e., where an operation is not atomic, as for arithmetic on complex
>numbers).

This is more a `happy accident of generating better code' than an attempt
to protect against programmer blunders.  Change your second routine to

	subroutine multc(c1,c2,c3,c4)
	complex c1, c2, c3, c4
	c3 = c1 * c2
	c4 = c1 * c3
	return
	end

and note that if `c1' and `c3' denote the same variable, the second
expression effectively stores (c1 * c2) ** 2 in c4.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris