From: portal!cup.portal.com!R_Tim_Coslet@uunet.uu.net
Subject: Re: help with Ada question
Date: 4 Nov 92 03:11:33 GMT [thread overview]
Message-ID: <68832@cup.portal.com> (raw)
In article: <1992Nov1.090527.29814@beaver.cs.washington.edu>
pschwrtz@lynx.cs.washington.edu (Paul Schwartz) wrote:
>robert walker (rwalker@barnacle.micro.umn.edu) wrote:
>:
>: If neither an exit nor a goto statement were available for Ada, how
>: might you simulate the action of an exit statement?
>:
> The easiest way would be to put the loop in a block and use an
>EXCEPTION to get out of the loop. As in;
>fooLoop:
>BEGIN
> LOOP
> IF <condition> THEN
> RAISE Some_Error;
> END IF;
>
> stuff
> END LOOP;
> EXCEPTION
> WHEN Some_Error => NULL; --you just wanted out of the loop
>END fooLoop;
>
It may be EASY, but don't EVER use exceptions as a "normal" means of
exiting a loop!!!! The overhead of an exception may be significant and
this is a misuse of the feature!!!
This is fine, IFF the exit from the loop was because of an error condition
that would normally never occur.
Of course this is purely a "class assignment" question, as any real programming
rules would never prohibit use of exit statements!
R. Tim Coslet
Usenet: R_Tim_Coslet@cup.portal.com
technology, n. domesticated natural phenomena
next reply other threads:[~1992-11-04 3:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-11-04 3:11 portal!cup.portal.com!R_Tim_Coslet [this message]
-- strict thread matches above, loose matches on Subject: below --
1992-11-01 9:05 help with Ada question Paul Schwartz
1992-10-27 15:47 pa.dec.com!nntpd2.cxo.dec.com!shodha!wallace
1992-10-27 15:31 pa.dec.com!nntpd2.cxo.dec.com!shodha!wallace
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox