Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!uflorida!haven!uvaarpa!hudson!bessel.acc.Virginia.EDU!gl8f From: gl8f@bessel.acc.Virginia.EDU (Greg Lindahl) Newsgroups: comp.lang.fortran Subject: Re: i++, i+=1, i=i+1 Message-ID: <561@hudson.acc.virginia.edu> Date: 16 Sep 88 17:52:47 GMT References: <3976@h.cc.purdue.edu> <3659@lanl.gov> Sender: news@hudson.acc.virginia.edu Reply-To: gl8f@bessel.acc.Virginia.EDU (Greg Lindahl) Organization: Dept. of Astronomy, University of Virginia Lines: 21 In article <3659@lanl.gov> jlg@lanl.gov (Jim Giles) writes: > > [stuff deleted] > >No, it doesn't cause the subscript to be evaluated twice. In Fortran >functions are not allowed to have side effects. The compiler will >therefore recognize the subscript expressions as common subexpressions >and will evaluate only once. [...] > VAX/VMS fortran doesn't work this way, even with math library functions which are known to have no side-effects. if you write a = sin(x) b = sin(x) c = sin(x) it will call sin() 3 times. anyone have any idea why they would do this? Greg Lindahl internet: gl8f@virginia.edu U Va Dept. of Astronomy bitnet: gl8f@virginia.bitnet