comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org>
Subject: Re: Puzzling small piece of code - exception block essentially used as goto
Date: Sat, 02 Jun 2007 05:48:05 GMT
Date: 2007-06-02T05:48:05+00:00	[thread overview]
Message-ID: <pw78i.143846$_c5.96836@attbi_s22> (raw)
In-Reply-To: <vQ68i.99$UD4.49@trndny07>

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



  reply	other threads:[~2007-06-02  5:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-02  5:01 Puzzling small piece of code - exception block essentially used as goto Anonymous Coward
2007-06-02  5:48 ` Jeffrey R. Carter [this message]
2007-06-05  2:38   ` Anonymous Coward
2007-06-05  4:10     ` tmoran
2007-06-05  4:53       ` tmoran
2007-06-02  6:16 ` tmoran
2007-06-05  0:08 ` Adam Beneschan
2007-06-05  7:58 ` anon
2007-06-05 10:40   ` Markus E Leypold
2007-06-05 23:43   ` Anonymous Coward
2007-06-06 10:39     ` Markus E Leypold
2007-06-08  0:55       ` Anonymous Coward
2007-06-08  2:22         ` Markus E Leypold
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox