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!attcan!uunet!cs.utexas.edu!rice!uw-beaver!uw-june!pattis From: pattis@cs.washington.edu (Richard Pattis) Newsgroups: comp.lang.ada Subject: Re: AND and expression evaluation Summary: I think I'm getting the idea Message-ID: <12002@june.cs.washington.edu> Date: 25 May 90 15:16:26 GMT References: <9005241409.AA10929@ajpo.sei.cmu.edu> Organization: U of Washington, Computer Science, Seattle List-Id: I apologize to Norman for quoting out of context; I was confused enough at the time to not understand the necessary context. Part of my confusion was caused by a similar example he gave on page 223, saying Y = 0 OR X/Y = 10 will evaluate both operands (of course, this is before the chapter on exceptions, so it was a true statement based on what was known up to that time). I was certainly hung up on what the compiler must/may do. So, if I have this right, the simplest "correct" thing to say is that AND and OR evaluate their operands fully. The one exception (excuse me) is when the only effect of evaluating the "second" operand is to raise a predefined exception. So, a compiler may optimize an AND to an AND THEN if one of its operands is simple enough for the compiler to verify that the only effect of evaluating that operand is computing a value or raising a predefined exception (no side effects, no possibility of user defined exceptions). "Second" here does not mean "right", since any operand may be evaluated first. Does that cover it; or are there fleas on fleas? Rich Pattis