Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!psuvax1!gondor.psu.edu!przemek From: przemek@gondor.psu.edu (Przemyslaw Klosowski) Newsgroups: comp.lang.fortran Subject: Re: FORTRAN value passed parameters revisited Message-ID: <3005@psuvax1.psu.edu> Date: Fri, 16-Oct-87 12:57:26 EDT Article-I.D.: psuvax1.3005 Posted: Fri Oct 16 12:57:26 1987 Date-Received: Sat, 17-Oct-87 20:57:32 EDT References: <5359@jade.BERKELEY.EDU> <2702@xanth.UUCP> Sender: netnews@psuvax1.psu.edu Reply-To: przemek@gondor.psu.edu (Przemyslaw Klosowski) Organization: Penn State University, University Park, PA Lines: 31 Keywords: Value passed, f77 In article <5359@jade.BERKELEY.EDU> lagache@violet.berkeley.edu (Edouard Lagache) writes: > > A few days ago I pointed out a dirty trick that ought to make > if possible to have the effect of value passed parameters in FORTRAN. >[...]but I also recieved > a message that it doesn't work under some cases. Apparantly, the f77 > compiler "sees" through the 'X+0' trick and makes X a variable pass > parameter. Several people pointed that optimizing compilers do see thru that, and call foo((x+0)) compiles to the same thing as call foo(x). Let me point however that if you want to avoid the ``variable'' problem, you are probably safe with dummy=x call foo(dummy) which is (to me) cleaner. REMINDER: there is always this proverbial bug when you do: call foo(5) print(*,*)5 .... subroutine foo(n) n=6 end and you get ``6'' printed out! przemek przemek@psuvaxg.bitnet psuvax1!gondor!przemek