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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7596cfba54ad3207 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-04 02:03:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!teaser.fr!enst!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: Trivial Ada question Date: Thu, 4 Jul 2002 10:59:30 +0200 (MET DST) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1025773383 46634 137.194.161.2 (4 Jul 2002 09:03:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 4 Jul 2002 09:03:03 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: PV4aFczGBi7pBRb/zS95gA== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.11 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:26856 Date: 2002-07-04T10:59:30+02:00 > * Darren New wrote: > >"Robert I. Eachus" wrote: [I do not remeber the exact form of Eachus', it was something like the following:] for i in A'Range loop if not condition (A (i)) then goto Dont_Increment; end if; end loop; n := n + 1; <> > >> Notice that a > >> compiler might generate identical code for these two examples. What > >> makes one right and the other wrong? > > > >Because the compiler isn't the only one that reads the code? > > > >"exit when ..." says to leave the innermost loop. > >"goto skip" doesn't tell you anything about what "skip" means. > > So simply write: > > INCREMENT: for dummy in 1 .. 1 loop > for i in a'Range loop > exit INCREMENT when condition (a (i)); > end loop; > n := n + 1; > end loop; > > No 'evil' goto, and a 'telling' label. This was a joke, wasn't it? Is this really better than a simle and innocent and nearby goto? A one-time 'loop' enclosing another work loop... These goto wars are astounding. Event the most simple goto solution is replaced by a contrived no-goto one! I have to confess that I have not needed a goto in so many years, but the goto solution is one of the simplest solutions of all those presented.