Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!think.com!yale.edu!cmcl2!beta!cochiti.lanl.gov!jlg From: jlg@cochiti.lanl.gov (Jim Giles) Newsgroups: comp.lang.fortran Subject: Re: Questions about IF Message-ID: <26462@beta.gov> Date: 25 Jun 91 20:10:38 GMT References: <1991Jun24.213601.11329@milton.u.washington.edu> <26384@lanl.gov> <1991Jun25.124806.15349@cs.dal.ca> Sender: news@beta.gov Organization: Los Alamos National Laboratory Lines: 23 In article <1991Jun25.124806.15349@cs.dal.ca>, silvert@cs.dal.ca (Bill Silvert) writes: |> In article <26384@lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes: |> >Actually, the standard does require that no optimization |> >violate parenthesis. So you can force the order of |> >evaluation any way you want: |> > |> > If (expr1 .and. (expr2.and.expr3)) then |> > ... |> > |> >This does the second '.and.' first. The other question was about |> >short-circuiting: the standard _allows_ short-circuiting but does |> >not _require_ it. |> |> Sorry, this doesn't make sense to me. All the parentheses guarantee is |> that expr1 will not be evaluated second. Both the sequences 1-2-3 and |> 3-2-1 are consistent with the given parentheses. You misunderstand the parenthesis rule. The objects I've called `expr1', `expr2', and `expr3' can be evaluated in _any_ order. The parenthesis force the 'and' between `expr2' and `expr3' to be evaluated before the other 'and'. That's all. J. Giles