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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ee1a8b8db84c88f,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.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: Ada exception block does NOT work? Date: Tue, 16 Aug 2005 16:48:30 +0800 Organization: HiNetNews Message-ID: NNTP-Posting-Host: 211-21-128-195.hinet-ip.hinet.net X-Trace: netnews.hinet.net 1124182127 27159 211.21.128.195 (16 Aug 2005 08:48:47 GMT) X-Complaints-To: usenet@HiNetnews.hinet.net NNTP-Posting-Date: Tue, 16 Aug 2005 08:48:47 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Xref: g2news1.google.com comp.lang.ada:4128 Date: 2005-08-16T16:48:30+08:00 List-Id: dear All: I am writing some application about stock trade. my program will fetch data from database and start some work. in a extreame case.my program crash. I feel very strange, and write a test code to test. I found Ada can not re-enter the exception block twice.(oh! my god) It should be work. of course!,I could do some check before really job. I just want to know what cause the exception problem. my test evnironment is win2k and win xp. they are not work well. I have try those compiler: Gnat 3.15 p / mingw 3.42 / mingw 4.1 does any one have idea to fix the exception block problem? or give me some guide to avoid the problem? thanks. --the test code is With Ada.Text_Io; Procedure Trading Is Type Price Is Delta 0.01 Digits 18; Type PriceArray Is Array (Positive Range <>) Of price; Procedure Avg (Data : In PriceArray) Is Avg, Sum : Price'Base := 0.0; Begin Ada.Text_Io.Put ("average:" ); For Index In Data'Range Loop Sum := Sum + Data (Index); End Loop; Avg := Sum / Data'Length; Ada.Text_Io.Put (Price'Image (Avg)); Ada.Text_Io.New_Line; Exception When Others => Ada.Text_Io.Put_Line ("error here!"); End; Begin For Index In Reverse 0 .. 9 Loop For Step In 1 .. 3 Loop Declare Mydata : Pricearray (1 .. Index) := (Others => 10.0); Begin Avg (Mydata); End; End Loop; End Loop; end Trading; ----end the test code