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,db5c6b2ef47d4b9e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-20 16:45:53 PST From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: short-circuit control forms Organization: RMIT References: User-Agent: MT-NewsWatcher/3.0 (PPC) Date: Thu, 21 Jun 2001 09:45:27 +1000 Message-ID: NNTP-Posting-Host: bundmac.cs.rmit.edu.au X-Trace: 21 Jun 2001 09:44:16 +1100, bundmac.cs.rmit.edu.au Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.mel.connect.com.au!newshub1.rdc1.nsw.optushome.com.au!news1.optus.net.au!optus!vrn.edu.au!mercury.its.rmit.edu.au!dale Xref: archiver1.google.com comp.lang.ada:8947 Date: 2001-06-21T09:45:27+10:00 List-Id: Ted Dennison wrote: > I'm not sure what the LRM's silence on a subject means in this case. But > assuming it means "all bets are off", then it looks to me like compilers > are > perfectly free to short-circuit, or even reorder and short-circuit normal > conditional expressions. The LRM guarentees order of execution for short circuit form, which is from left to right. Not all short circuit forms need be faster, this can depend on the architecture that is being compiled for. For example the following code if x = 2 and y = 3 then could have both comparisons scheduled on a modern processor with numerous integer units so that they occur simultaneously. As always, measure before you optimise. Dale