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-Thread: 103376,803d147296719896 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Puzzling small piece of code - exception block essentially used as goto References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1180763285 12.201.97.213 (Sat, 02 Jun 2007 05:48:05 GMT) NNTP-Posting-Date: Sat, 02 Jun 2007 05:48:05 GMT Organization: AT&T ASP.att.net Date: Sat, 02 Jun 2007 05:48:05 GMT Xref: g2news1.google.com comp.lang.ada:16046 Date: 2007-06-02T05:48:05+00:00 List-Id: Anonymous Coward wrote: > > 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? Control continues from the end of the block statement. > 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? Presumably the difficulty is evaluating the expression New_Hour - Hour. It may be impossible to determine which of the 3 calculations of Hour_Delta to use without evaluating the expression and seeing if it raises Constraint_Error. Or perhaps determining which of the 3 calculations of Hour_Delta to use is more complex than this code. Without knowing the details of the types of the variables used, I can't say. -- Jeff Carter "Propose to an Englishman any principle, or any instrument, however admirable, and you will observe that the whole effort of the English mind is directed to find a difficulty, a defect, or an impossibility in it. If you speak to him of a machine for peeling a potato, he will pronounce it impossible: if you peel a potato with it before his eyes, he will declare it useless, because it will not slice a pineapple." Charles Babbage 92