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,ee1a8b8db84c88f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!Spring.edu.tw!news.nctu.edu.tw!feeder.seed.net.tw!netnews!not-for-mail From: "bubble" Newsgroups: comp.lang.ada Subject: Re: Ada exception block does NOT work? Date: Tue, 16 Aug 2005 17:32:48 +0800 Organization: HiNetNews Message-ID: References: <4301ab29$0$6989$9b4e6d93@newsread2.arcor-online.net> NNTP-Posting-Host: 211-21-128-195.hinet-ip.hinet.net X-Trace: netnews.hinet.net 1124184785 8751 211.21.128.195 (16 Aug 2005 09:33:05 GMT) X-Complaints-To: usenet@HiNetnews.hinet.net NNTP-Posting-Date: Tue, 16 Aug 2005 09:33:05 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Xref: g2news1.google.com comp.lang.ada:4130 Date: 2005-08-16T17:32:48+08:00 List-Id: dear Georg: thank to your reply so quickly. and the problem still not be sloved. you can test "test code". you will find some thing interesting. the statement , Avg := Sum / Data'Length; should be throw a exception signal when Data'length is 0 (empty array) and then the exception block handler should catch the signal, and do some recovery process. in the test case, it doesn't work in first exceptin case, Ada throw a exception and transfer the control to exception handler (greater). in 2nd exception case,Ada "should" throw exception and do control transfer. Unfortunately, it does not do. > bubble wrote: > >> I found Ada can not re-enter the exception block twice.(oh! my god) >> It should be work. > > It does :-). Reentering means to loop, so you could write, > in your procedure's body > > loop > begin > some_computation(data); > exit retrying; > exception > when Some_Exception => > report; > make_adjustments; > end; > end loop; > > or > > retry: loop > begin > some_computation(data); > exit retry; > exception > when Some_Exception => > report; > make_adjustments; > end; > end loop retry;