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,cf677878aa77e0d8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-13 10:25:42 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!netnews.com!xfer02.netnews.com!newsfeed1.cidera.com!news-reader.ntrnet.net!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: an infinate loop X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3B4F2962.25BB60FF@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: Mime-Version: 1.0 Date: Fri, 13 Jul 2001 17:01:22 GMT X-Mailer: Mozilla 4.5 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:9917 Date: 2001-07-13T17:01:22+00:00 List-Id: Ted Dennison wrote: > > For another, most of your "exit" statements are all at the tops of the loops. In > those cases you should probably reverse the test logic and use "while" loops > instead. This is bad advice. The form that uses positive logic is best. exit when End_Of_File; uses positive logic, and is better than while not End_Of_File loop which uses negative logic. All of the exits in this program use positive logic. In general, exit tends to use positive logic and while tends to use negative logic. However, when exiting from nested loops, it is a good idea to name your loops and use the loop names on the exit statements and the end loop statements. This badly formatted program is hard enough to understand without trying to figure out which end loop corresponds to which exit. At the "Ada Launch" (1980 Dec 10), Ichbiah, Barnes, and Firth introduced the recently renamed Ada language (MIL-STD 1815, formerly Green, now known as Ada 80) to the world. They said "while" was in the language primarily to support translation from languages such as Pascal, and advised using the "loop ... exit when" format in new code. -- Jeffrey Carter