Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!ukc!strath-cs!ex-dcs!exua!JRowe From: JRowe@exua.exeter.ac.uk (John Rowe) Newsgroups: comp.lang.fortran Subject: Re: Questions about IF Message-ID: Date: 24 Jun 91 12:25:25 GMT References: Sender: JRowe@exua.exeter.ac.uk Organization: Computer Unit. - University of Exeter. UK Lines: 27 In-reply-to: br0w+@andrew.cmu.edu's message of 23 Jun 91 16:55:59 GMT In article br0w+@andrew.cmu.edu (Bruno W. Repetto) writes: > IF(.AND..AND. ... .AND.)statement > My questions are about the STANDARD for executing such a command: > 1) Are the expressions evaluated from "left to right"? I doubt it. The 77 standard says (section 6.6.7) "the processor may evaluate any other expression that is logically equivalent, provided that the integrity of parentheses is not violated." I assume that allows it to reverse the ordering. > 2) Supposing 1) above is true, if expressions 1 to i evaluate to .TRUE., and > expression i+1 evaluates to .FALSE., are the subsequent expressions > evaluated (if any remain), or is the execution of the IF command concluded > right then? The compiler has the choice. The standard says (6.6.1) "It is not necessary", it doesn't say "shall not". Basically FORTRAN is about you specifying a FORmula and the compiler TRANslating in the fastest way it can. Things like an expression, one part of which is only evaluated if another part is true/false are totally alien, unlike say in C. John