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

* Re: AND and argument evaluation
  1990-05-29  5:48 AND and argument evaluation "", Mats Weber
@ 1990-05-31 16:27 ` James THIELE
  0 siblings, 0 replies; 2+ messages in thread
From: James THIELE @ 1990-05-31 16:27 UTC (permalink / raw)


[A very long discussion over many messages extensively quoting the
[Ada LRM and various Ada books with numerous comments on abstract
[conditions where optimization is allowed by compilers deleted.

When I worked with Ada, 1986-9, I remember many times when a
seemingly simple question about Ada syntax or semantics required
a long treasure hunt through the LRM.  The answers were almost
always buried in references to other sections.

Sure, I can now tell you quickly why "for Index in -1..1 loop"
is not valid Ada, but you won't find a comment about "-1..1"
in the section on "for".

Which brings me to my favorite quote about Ada:

	"Ada is PASCAL for lawyers."

Anyone know who said it first?

James Thiele -- microsoft!jamesth

^ 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