comp.lang.ada
 help / color / mirror / Atom feed
* AND and argument evaluation
@ 1990-05-29  5:48 "", Mats Weber
  1990-05-31 16:27 ` James THIELE
  0 siblings, 1 reply; 2+ messages in thread
From: "", Mats Weber @ 1990-05-29  5:48 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1990-05-31 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1990-05-29  5:48 AND and argument evaluation "", Mats Weber
1990-05-31 16:27 ` James THIELE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox