From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_40 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 8 Apr 93 19:03:30 GMT From: news.crd.ge.com!sunup!duncan@uunet.uu.net (Art Duncan) Subject: Re: and then Message-ID: List-Id: I think the question of "and then" was discussed in this group about a year ago. One question was whether or not an expression like if X /= 0 and Y/X > 3 then ... end if; should raise an exception if X = 0. If "and" is optimized to "and then" it will not. However, the prevailing wisdom at that time was that the above expression should raise an exception when X = 0. There is also a matter of uniformity of the language. If B1, B2, and B3 are boolean vectors of the same dimension, the expression B1 and B2 and B3 will (and should) and them all together. There is also the phrase " ... and the operands of an expression that does not contain a short-circuit control form, are evaluated in SOME order that is not defined by the language." This means that it is perfectly legal for the compiler to generate code that evaluates X/Y > 3 before evaluating X /= 0 The term "some order" is used frequently in the LRM, with the implication that any expression that depends, for its meaning, on the order of evaluation is erroneous. Thus, if one wishes to force the order of evaluation, the only linguistically correct method is to use the short circuit forms. Cheers, - Art Duncan General Electric Company Corporate Research and Development Schenectady, NY 12301 duncan@crd.ge.com