From: tmoran@acm.org
Subject: Re: Puzzling small piece of code - exception block essentially used as goto
Date: Sat, 02 Jun 2007 01:16:03 -0500
Date: 2007-06-02T01:16:03-05:00 [thread overview]
Message-ID: <Zc-dnUU-f4K-lvzbnZ2dnUVZ_sKunZ2d@comcast.com> (raw)
In-Reply-To: vQ68i.99$UD4.49@trndny07
> What I would like clarification on is when the
> exception block ends, where is control returned to?
Control isn't "returned" anywhere. It flows to the next statement
after the block. In this case the next statement is:
> end loop Delta_Beyond_Max_Minutes;
> 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?
Assuming that Hour is the only output and Hour_Delta and
Still_Looping are not used anywhere else,
Set Hour to (approximately) New_Hour. Specifically, if New_Hour
is sufficiently close to Hour (ie, New_Hour - Hour fits in the
legal range of Hour_Delta), then set Hour := New_Hour.
Otherwise, step Hour forward by Max_Hour_Delta, or backward
by (Max_Hour_Delta - Relative_Time), as many times as necessary to
make New_Hour - Hour fit in that range.
It would be helpful to know the range of Hour_Delta and to have some idea
what Max_Hour_Delta and Relative_Time might be, to figure out just what
the programmer was trying to accomplish.
next prev parent reply other threads:[~2007-06-02 6:16 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
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 [this message]
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