Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site utah-gr.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!utah-cs!utah-gr!donn
From: donn@utah-gr.UUCP (Donn Seeley)
Newsgroups: net.lang
Subject: Re: Constants in subroutine calls
Message-ID: <1298@utah-gr.UUCP>
Date: Fri, 11-Jan-85 17:08:21 EST
Article-I.D.: utah-gr.1298
Posted: Fri Jan 11 17:08:21 1985
Date-Received: Sun, 13-Jan-85 08:24:13 EST
References: <606@spuxll.UUCP> <468@ecsvax.UUCP>
Organization: University of Utah CS Dept
Lines: 45
Summary: Read the f77 standard before commenting on it


	From: ech@spuxll.UUCP (Ned Horvath)

	This awful FORTRAN behavior is wired into the STANDARDS, to
	wit: FORTRAN uses call by 'value-result': each argument is
	copied, the copies are passed, and at return the copies are
	copied back to the original arguments.  This is not quite the
	same as call by reference, since (for example) you can pass a
	variable which is in COMMON and the subroutine can modify
	either copy without the effects being replicated in the other
	-- until it returns!

ANSI X3.9-1978, section 15.9.3.6, p. 15-20:

	If a subprogram reference causes a dummy argument to become
	associated with an entity in a common block in the referenced
	subprogram or in a subprogram referenced by the referenced
	subprogram, neither the dummy argument nor the entity in the
	common block may become defined within the subprogram or within
	a subprogram referenced by the referenced subprogram.  For
	example, if a subroutine contains the statements:

		SUBROUTINE XYZ (A)
		COMMON C

	and is referenced by a program unit that contains the
	statements:

		COMMON B
		CALL XYZ (B)

	then the dummy argument A becomes associated with the actual
	argument B, which is associated with C, which is in a common
	block.  Neither A nor C may become defined during execution of
	the subroutine XYZ or by any procedures referenced by XYZ.

As has been said before in this newsgroup, the standard does not
require either call by reference or call by value-result -- it permits
either.

The equine mammal appears to have expired despite repeated concussions,

Donn Seeley    University of Utah CS Dept    donn@utah-cs.arpa
40 46' 6"N 111 50' 34"W    (801) 581-5668    decvax!utah-cs!donn