Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn
From: gwyn@brl-smoke.ARPA (Doug Gwyn )
Newsgroups: comp.lang.c
Subject: Re: call by address (was Re: compilers
Message-ID: <6750@brl-smoke.ARPA>
Date: Thu, 26-Nov-87 23:02:04 EST
Article-I.D.: brl-smok.6750
Posted: Thu Nov 26 23:02:04 1987
Date-Received: Sun, 29-Nov-87 18:39:28 EST
References: <12114@think.UUCP> <47000023@uxe.cso.uiuc.edu>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) )
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 25

In article <47000023@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes:
>In article <6715@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes:
[example deleted]
>This is not a C issue, but neither is it Fortran, as the example is not a
>legal Fortran program. Any possible run-time behaviour is possible: Fortran
>does not define it. The reason is that Fortran does not permit an actual
>argument (the "3" in FUNC(3) ) to be modified in FUNC (the K=5 line).
>It is up to the programmer not to write erroneous programs. (okay,
>I am wearing a flameproof suit)

I wasn't putting this forward as an example of a correct program,
but rather as a counterexample in an argument against the notion
that Fortran parameters "are" always passed by reference.  The
only way I know of for an implementation to detect that I was
trying a no-no (assuming the reference and definition of the
function to be in separately-compiled modules) would be through
the use of dope vectors or some similar mechanism, but then that
too would make my point, being clearly not pure call by reference.
Expressions are handled differently from variables in this regard,
precisely BECAUSE they have no address to be referenced.

To make this somewhat C-pertinent, I view C's adoption of call
by value for all (well, almost all) function parameters, made
feasible by having decent pointer types available, as a
significant design improvement over Fortran and Pascal.