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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no 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-7-bit Received: by 10.68.35.68 with SMTP id f4mr28932078pbj.5.1321390502490; Tue, 15 Nov 2011 12:55:02 -0800 (PST) Path: h5ni58615pba.0!nntp.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: GNAT 4.4.5 order of conditional processing? Date: Tue, 15 Nov 2011 21:54:59 +0100 Organization: Tidorum Ltd Message-ID: <9ig1t4F4uaU1@mid.individual.net> References: Mime-Version: 1.0 X-Trace: individual.net 464Mj8QfP38nL3uMV/4LLQZlujIF/OEMAnN/EnGdEf+8GGGhYR Cancel-Lock: sha1:6qyvCqohizHwCzSa/VIka1q2F2w= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 In-Reply-To: Xref: news2.google.com comp.lang.ada:14419 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-11-15T21:54:59+01:00 List-Id: On 11-11-15 21:30 , awdorrin wrote: > Given an IF statement such as the following: > > if X = Y and not A and B > > How does GNAT handle the processing of the conditional statements? > Will "X = Y" be processed first, and if false, will the rest be > skipped? If you want to be sure that the later conjuncts are evaluated only if X=Y, use the "and then" form. The following first evaluates "X = Y", and then evaluates "not A and B" only if X = Y: if X = Y and then (not A and B) then do something end if; Or, expand also the later "and" so that B is evaluated only if X = Y and A is false: if X = Y and then (not A) and then B then do something end if; -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .