Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!think!snorkelwacker!spdcc!esegue!johnl From: johnl@esegue.segue.boston.ma.us (John R. Levine) Newsgroups: comp.lang.misc Subject: Re: NOT Educating FORTRAN programmers to use C Message-ID: <1990Jan24.035548.13115@esegue.segue.boston.ma.us> Date: 24 Jan 90 03:55:48 GMT References: <12950@cbnewsc.ATT.COM> <14199@lambda.UUCP> <4540@scolex.sco.COM> Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine) Organization: Segue Software, Cambridge MA Lines: 29 In article <4540@scolex.sco.COM> seanf@sco.COM (Sean Fagan) writes: > x[i] = x[i] + foo(); >vs. > x[i] += foo(); > >where one or more of x and i are global. Oops. If your FORTRAN copmiler >optimizes that away, you quite probably, have some problems. If you write code that depends on the order of evaluation of foo() and x[i], you certainly have problems. Quoting again from F77, secton 6.6, Evaluation of Expressions, "The execution of a function reference in a statement may not alter the value of any other entity within the statement in which the function appears. The execution of a function reference in a statement may not alter the value of any entity in common that affects the value of any other function reference in that statement." In a later paragraph it also says that it need not evaluate part of all of an expression if it can figure out the value some other way. This explicitly permits short circuit (C style) evaluation of logical expressions and implicitly allows arbitrarily agressive common subexpresion elimination. People who express strong opinions about what a Fortran compiler should and shouldn't do would be well advised to have at least a passing familiarity with what the standard says Fortran really is. I express no opinions on F90 yet, I'm still chewing through my copy of the draft. -- 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."