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,d0310bb11aeb7260 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.0.170 with SMTP id 10mr29867056pbf.2.1321406310559; Tue, 15 Nov 2011 17:18:30 -0800 (PST) Path: h5ni59325pba.0!nntp.google.com!news2.google.com!postnews.google.com!m13g2000prl.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: GNAT 4.4.5 order of conditional processing? Date: Tue, 15 Nov 2011 17:18:30 -0800 (PST) Organization: http://groups.google.com Message-ID: <8f003611-8375-4de7-bfd0-1d6b3f910c30@m13g2000prl.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1321406310 32359 127.0.0.1 (16 Nov 2011 01:18:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 16 Nov 2011 01:18:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m13g2000prl.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: news2.google.com comp.lang.ada:14425 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-11-15T17:18:30-08:00 List-Id: On Nov 15, 3:08=A0pm, Jeffrey Carter wrote: > > Note that the short circuit forms should not be considered optimizations.= With > modern processors, unnecessary short-circuit forms may sometimes be slowe= r than > the regular equivalents. Yeah, but the compiler should be able to figure it out and generate the best code. No matter what the Ada language says, if you write "A and then B" and A and B are Boolean variables, it's perfectly legal for the compiler to generate an instruction that reads the register that currently contains B. (I mean a normal register, not a memory- mapped I/O register.) The only time it should be necessary to use "and" instead of "and then" (on Boolean operands) is if the right side contains a function call (or, perhaps, a read of a variable that's mapped to some special hardware address) that you absolutely want to take place regardless of the left side. -- Adam