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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-04 09:31:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0900.news.uu.net!reader0901.news.uu.net!not-for-mail Message-ID: <3C35E733.6030603@mail.com> Date: Fri, 04 Jan 2002 12:32:35 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.7+) Gecko/20011228 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A case where Ada defaults to unsafe? References: <3C34BF2C.6030500@mail.com> <3C34D252.4070307@mail.com> <5ee5b646.0201040829.18db8001@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Cache-Post-Path: master.nyc.kbcfp.com!unknown@mosquito.nyc.kbcfp.com X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1010165514 reader1.ash.ops.us.uu.net 11370 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:18547 Date: 2002-01-04T12:32:35-05:00 List-Id: Robert Dewar wrote: > Well any vaguely competent Ada programmer should equally > well know that in Ada "and then" and "or else" short circuit > and "and" and "or" do not. Sure. But what do you gain from the non-short-circuit ones, except for the risk that you've used them incorrectly? > Exactly the same as in C, where you use either & or &&. In C, you cannot use & and | in the same way that you use && and ||, because the former accept only integer operands. For example, if you have a pair of pointers, p and q, and wish to test whether both are not null, you must use p&&q. If you were to use p&q, the compiler would reject it. C++ does have the horrible trap that user-defined && and || operators don't short-circuit. Expert advice is to never define these except in the rarest of circumstances.