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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,803d147296719896 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!wn13feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Puzzling small piece of code - exception block essentially used as goto Reply-To: anon@anon.org (anon) References: X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Tue, 05 Jun 2007 07:58:49 GMT NNTP-Posting-Host: 12.64.102.139 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1181030329 12.64.102.139 (Tue, 05 Jun 2007 07:58:49 GMT) NNTP-Posting-Date: Tue, 05 Jun 2007 07:58:49 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:16070 Date: 2007-06-05T07:58:49+00:00 List-Id: Looks like a HOMEWORK problem to me: And I do not help students cheat! In , Anonymous Coward writes: >This is an excerpt from some code I recently encountered (it may give >some of you a headache): > > Still_Looping := True; > > Delta_Beyond_Max_Minutes: > while Still_Looping loop > > Handle_Max_Minute_Error: > begin > > Hour_Delta := New_Hour - Hour; > Still_Looping := False; > Hour := New_Hour; > > exception > when Constraint_Error => > > if New_Hour > Hour then > > Hour_Delta := Max_Hour_Delta > > else > > Hour_Delta := Relative_Time - Max_Hour_Delta; > > end if; > > Hour := Hour + Hour_Delta; > > end Handle_Max_Minute_Error; > end loop Delta_Beyond_Max_Minutes; > >Tests show that this code actually loops a few times when run in a >typical state. What I would like clarification on is when the >exception block ends, where is control returned to? > >Also, anyone up for the challenge of rewriting this without the >exception handler so the rest of us humans can understand what it's >doing?