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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-07 10:33:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.direct.ca!look.ca!brick.direct.ca!brie.direct.ca.POSTED!not-for-mail Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; format=flowed From: FGD MIME-Version: 1.0 Message-ID: <3C39EB92.6040200@look.ca> NNTP-Posting-Date: Mon, 07 Jan 2002 10:29:58 PST NNTP-Posting-Host: 209.148.72.68 Newsgroups: comp.lang.ada Organization: Look Communications - http://www.look.ca References: <3C34BF2C.6030500@mail.com> <3C34D252.4070307@mail.com> <5ee5b646.0201040829.18db8001@posting.google.com> <3C35E733.6030603@mail.com> <3C35FE2A.9020802@mail.com> <3C360E76.3070308@mail.com> <3C39C120.1060706@mail.com> <3C39D86C.7030704@mail.com> <3C39E520.6030508@mail.com> Subject: Re: A case where Ada defaults to unsafe? User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us X-Complaints-To: abuse@look.ca X-Trace: brie.direct.ca 1010428198 209.148.72.68 (Mon, 07 Jan 2002 10:29:58 PST) Date: Mon, 07 Jan 2002 13:40:18 -0500 Xref: archiver1.google.com comp.lang.ada:18618 Date: 2002-01-07T13:40:18-05:00 List-Id: Hyman Rosen wrote: > Pat Rogers wrote: > >> Well of course "and" is allowed to ignore one of the operands; if the >> first one >> evaluated is false, there is no need to evaluate the second. We are >> just not >> guaranteed which is evaluated first. > > You are quite wrong. So much for the claim that experienced Ada > programmers simply learn the difference between "and" and "and then"! > See, for example, 3.8 in the Ada83 Rationale. > That's not quite right either, the end result of "cond_1 and cond_2" must be *as if* both cond_1 and cond_2 were evaluated. The Boolean operator and is just like any function, but it is expanded inline and may be optimized by the compiler. So the compiler could omit the evaluation of a condition if it is known not to have side effects. This happens frequently when the conditions are comparisons of numeric types for example. -- Frank