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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-25 09:33:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Wed, 25 Feb 2004 12:33:40 -0500 From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions References: <1075987360.225622@master.nyc.kbcfp.com> <40236C0B.E988E003@0.0> <1077634311.254581@master.nyc.kbcfp.com> <1077718871.47635@master.nyc.kbcfp.com> <54cp3095jmv8s17h63d4bjdus0tec7l7pt@jellix.jlfencey.com> <1077721343.481619@master.nyc.kbcfp.com> <1077724400.221032@master.nyc.kbcfp.com> <1077728214.676718@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1077730428.46831@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1077730428 6522 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:5808 Date: 2004-02-25T12:33:40-05:00 List-Id: Preben Randhol wrote: > My point was that when you use the and then you tell the compiler to > evaluate left-side before right. Whereas if you use only and it is not > given which side will be evaluated first. At least I thought so. Yes, that's correct. However, program behavior is always subject to the "as if" convention. That is, the program must have observable behavior as if the compiler did things in the order that the language specified, but that observable behavior is limited by the language definition to things like I/O, calling imported subprograms, and some other stuff that can be loosely categorized as side-effects. In the proposed case of (sqrt(x) > 0.5 and b), if sqrt(x) has side effects it must be evaluated regardless of the value of b, and if it has no side effects you cannot know if it has been evaluated, and so the compiler may evaluate b first and never evaluate sqrt(x) at all. The latter holds even if you write (sqrt(x) > 0.5 and then b).