Article View: comp.lang.misc
Article #810Re: Re: NOT Educating FORTRAN programmers to use C
From: John R. Levine
Date: Fri, 19 Jan 1990 05:22
Date: Fri, 19 Jan 1990 05:22
23 lines
1832 bytes
1832 bytes
In article <8960004@hpfcso.HP.COM> mjs@hpfcso.HP.COM (Marc Sabatella) writes:
>Do you mean it is even illegal to pass the same argument in two
>different positions of a formal parameter list? For instance:
>
>subroutine foo (x, y)
>call foo (a, a)
That's exactly what I mean, if foo changes x or y. Quoting from my trusty
X3.9-1978 (don't leave home without it) section 15.9.3.6, "If a subprogram
reference causes a dummy argument in the referenced subprogram to become
associated with another dummy argument in the referenced subprogram, neither
dummy argument may become defined during execution of that subprogram." They
then give exactly your example as something not to do. The next paragraph
makes the same rule about arguments and common blocks.
In fact, this is just about the least portable Fortran you can write. Some
Fortrans indirectly address scalar parameters, others copy scalar arguments
in and out. Since there is no way to predict in what order arguments are
copied back, it is completely undefined which of x or y gets stored last.
--
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."
Technical Details
Message-ID:
<1990Jan19.052215.1886@esegue.segue.boston.ma.us>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!snorkelwacker!spdcc!esegue!johnlReferences:
<15623@haddock.ima.isc.com> <8960004@hpfcso.HP.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!snorkelwacker!spdcc!esegue!johnl From: johnl@esegue.segue.boston.ma.us (John R. Levine) Newsgroups: comp.lang.misc Subject: Re: Re: NOT Educating FORTRAN programmers to use C Message-ID: <1990Jan19.052215.1886@esegue.segue.boston.ma.us> Date: 19 Jan 90 05:22:15 GMT References: <15623@haddock.ima.isc.com> <8960004@hpfcso.HP.COM> Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine) Followup-To: comp.lang.fortran Organization: Segue Software, Cambridge MA Lines: 23