Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!munnari.oz.au!cs.mu.oz.au!ok From: ok@cs.mu.oz.au (Richard O'Keefe) Newsgroups: comp.lang.c Subject: Re: ambiguous ? Message-ID: <2520@munnari.oz.au> Date: 25 Oct 89 05:20:31 GMT References: <6637@ficc.uu.net> <14111@lanl.gov> <6658@ficc.uu.net> Sender: news@cs.mu.oz.au Lines: 22 In article <6658@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes: > DATA I /0/ > J = I * GETCH(5) > J = 0 * GETCH(6) > Is this legal? Yes (CF=0.9) > Is it guaranteed that GETCH(5) will be evaluated? If I is not modified elsewhere in the subprogram, no it is not. A Fortran compiler is allowed to exploit identities such as 0*X = 0 > Is it guaranteed that GETCH(6) will be evaluated? No. (Giles) > > if (getch(5) && getch(6)) {...} In the Fortran equivalent IF (GETCH(5) .AND. GETCH(6)) ... either operand may be evaluated first, and the other may or may not be evaluated depending on the outcome and the compiler-writer's choice. This is what it _means_ to exploit the mathematical properties of "and" as Giles recommends.