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-Thread: 103376,99e73f65ea2533b9 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news.glorb.com!nlpi057.nbdc.sbc.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: and then... (a curiosity) Date: Wed, 03 Sep 2008 01:56:32 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <18b41828-bda4-4484-8884-ad62ce1c831d@f36g2000hsa.googlegroups.com> <57qdnfULQ9tzKCHVnZ2dnUVZ_tHinZ2d@comcast.com> <48bd0003$1@news.post.ch> <5bca12f5-b6cc-4e7e-b020-ae0264531156@73g2000hsx.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls6.std.com 1220421392 19515 192.74.137.71 (3 Sep 2008 05:56:32 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 3 Sep 2008 05:56:32 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:/HCihIqU1kV0ZOAcDK8Zi94EbXo= Xref: g2news1.google.com comp.lang.ada:1888 Date: 2008-09-03T01:56:32-04:00 List-Id: Santiago Urue�a writes: > suggest using plain "and" / "or" operators when just boolean flags are > involved because it is usually faster to evaluate all the variables > than using lazy evaluation. I don't buy that argument, because the semantics of "A and B and C" are identical to the semantics of "A and then B and then C" (when A, B, and C are Boolean variables), so the compiler is free to generate identical code for both. If efficiency is important in this case, the compiler should be trained to make it efficient, and the programmer shouldn't have to worry about it. Your point for (non-inlined) function calls is valid, though -- the compiler can't be expected to know what's in the function in general. - Bob