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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,db5c6b2ef47d4b9e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-21 10:20:36 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.direct.ca!look.ca!news1.tor.metronet.ca!nnrp1.tor.metronet.ca!not-for-mail Message-ID: <3B322CCB.321225B6@home.com> From: "Warren W. Gay VE3WWG" X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: short-circuit control forms (& 'long names are doom') References: <3B30F836.D700DAA3@raytheon.com> <3B32038D.F1296C79@cadence.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 21 Jun 2001 17:20:13 GMT NNTP-Posting-Host: 198.96.47.195 NNTP-Posting-Date: Thu, 21 Jun 2001 11:20:13 MDT Organization: MetroNet Communications Group Inc. Xref: archiver1.google.com comp.lang.ada:8990 Date: 2001-06-21T17:20:13+00:00 List-Id: Paul Graham wrote: > "James A. Krzyzanowski" wrote: > > > > Looking for expert opinions... > > > > We have a company standard which states: > > "standard => Use short-circuit control forms to specify the order of > > conditions when the failure of one condition means that > > the other condition will raise an exception. > > guideline => Avoid short-circuit control forms otherwise." > > > > Looking at the GNAT 3.13p source code, I count about 5000 occurrences of > 'and then' and only about 400 occurrences of 'and' not followed by > 'then'. (This count is very approximate.) It seems that the GNAT > policy is to use 'and then' by default. Before arriving at that assumption, did you examine how many of those cases NEEDED to be that way? Since you didn't report a count of those, then I think we can safely assume that you didn't check that. It has been pointed out by many, that the spirit of the short-circuit forms is to avoid exceptions in evaluating the rest of the expression. If this is the case, then these are perfectly valid uses of the short-circuit forms. -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg