comp.lang.ada
 help / color / mirror / Atom feed
From: madmats@elcgl.epfl.ch ("", Mats Weber)
Subject: AND and argument evaluation
Date: 29 May 90 05:48:00 GMT	[thread overview]
Message-ID: <RFC-822:900527221328.2gp@sic.epfl.ch> (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

             reply	other threads:[~1990-05-29  5:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-05-29  5:48 "", Mats Weber [this message]
1990-05-31 16:27 ` AND and argument evaluation James THIELE
replies disabled

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