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: g2news2.google.com!postnews.google.com!r35g2000prm.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: and then... (a curiosity) Date: Wed, 3 Sep 2008 07:14:11 -0700 (PDT) Organization: http://groups.google.com 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: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1220451252 21578 127.0.0.1 (3 Sep 2008 14:14:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 3 Sep 2008 14:14:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r35g2000prm.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7623 Date: 2008-09-03T07:14:11-07:00 List-Id: On Sep 2, 10:56 pm, Robert A Duff wrote: > Santiago Urue=F1a 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), *Almost* true. It isn't true when some of those Boolean variables have 'Address clauses that cause them to be mapped to hardware I/O registers!! But I know what you meant. I'd go so far as to say a good compiler should generate the exact same code when the arguments are (normal, non-volatile) Boolean variables whether or not you use "and" or "and then", and similarly "or" or "or else". It should just pick whatever is fastest. -- Adam