From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!elcgl.epfl.ch!madmats From: madmats@elcgl.epfl.ch ("", Mats Weber) Newsgroups: comp.lang.ada Subject: AND and argument evaluation Message-ID: Date: 29 May 90 05:48:00 GMT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: RFC-822-Headers: Received: from elcgl.epfl.ch by SIC.Epfl.CH with VMSmail ; Sun, 27 May 90 22:13:25 N X-ST-Vmsmail-To: gw::"pattis@june.cs.washington.edu" gw::"info-ada@ajpo.sei.cmu.edu" ================== >Barnes (3rd Ed), top of page 61: > In the case of AND and OR, both operands are always evaluated but the >order is not specified. >Cohen, middle of page 490: > For example, an implementation may choose to optimize the expression > B/=0 and A/B > C > by evaluating it as if it were written > B/= 0 and then A/B > C >I can't find anything in the LRM (maybe I'm not looking in the right >spots) >that nails this down. In either case, someone's book is wrong. >Does someone know the "truth" about this issue? >Rich Pattis Barnes is wrong. The LRM allows an implementation to suppress evaluation of parts of expressions if these evaluations have no other effect than raising a predefined exception. Thus, in your example, if "/" and ">" denote predefined operators, then their evaluation may be suppressed in cases where B/=0 is false. The difference between "and" and "and then" is that with "and then", the right hand side operand MUST NOT be evaluated if the left hand side evaluates to false. Mats Weber Swiss Federal Institute of Technology EPFL DI LGL 1015 Lausanne Switzerland E-mail : madmats@elcgl.epfl.ch phone : +41 21 693 52 92 fax : +41 21 693 39 09