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!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.bahnhof.se!195.197.54.117.MISMATCH!feeder1.news.jippii.net!nntp.inet.fi!central1.inet.fi!inet.fi!read3.inet.fi.POSTED!53ab2750!not-for-mail Sender: AWI003@FIW9430 Newsgroups: comp.lang.ada Subject: Re: Ada exception block does NOT work? References: <4301ab29$0$6989$9b4e6d93@newsread2.arcor-online.net> <1124185355.610972.22710@f14g2000cwb.googlegroups.com> <9AnMe.418$zb.194@trndny03> <87hddou95a.fsf@tiscali.be> From: Anders Wirzenius Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 17 Aug 2005 11:34:10 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read3.inet.fi 1124278450 194.251.142.2 (Wed, 17 Aug 2005 14:34:10 EEST) NNTP-Posting-Date: Wed, 17 Aug 2005 14:34:10 EEST Organization: Sonera corp Internet services Xref: g2news1.google.com comp.lang.ada:4149 Date: 2005-08-17T11:34:10+00:00 List-Id: Ludovic Brenta writes: > I tried to reduce the test case, but it works for me; the exception is > raised and handled as many times as I want, and there is no infinite > loop. > I modified Ludovic's example to use attributes: with Ada.Exceptions; with Ada.Text_IO; procedure G is type T is delta 0.01 digits 18; -- type T is new Integer range 1..10; type T_Array is array (Positive range <>) of T; procedure P (N : in T_Array) is A : T'Base; begin A := T (10) / N'Length; Ada.Text_IO.Put_Line ("no problem: " & T'Base'Image (A)); exception when E: others => Ada.Text_IO.Put_Line ("Exception handled"); Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); end P; begin P ((1 .. 3 => T (10))); P ((1 .. 0 => T (10))); P ((1 .. 0 => T (10))); end G; ... and got on a Cygwin/Windows XP: $ gnat GNAT 3.15p (20020523) Copyright 1996-2002 Free Software Foundation, Inc. List of available commands GNAT BIND gnatbind GNAT CHOP gnatchop GNAT COMPILE gnatmake -f -u GNAT ELIM gnatelim GNAT FIND gnatfind GNAT KRUNCH gnatkr GNAT LINK gnatlink GNAT LIST gnatls GNAT MAKE gnatmake GNAT NAME gnatname GNAT PREPROCESS gnatprep GNAT STANDARD gnatpsta GNAT STUB gnatstub GNAT XREF gnatxref Commands FIND, LIST and XREF accept project file switches -vPx, -Pprj and -Xnam=val AWI003@fiw9430 /cygdrive/c/a/ada/investigate/trading $ gnatmake g gcc -c g.adb gnatbind -x g.ali gnatlink g.ali AWI003@fiw9430 /cygdrive/c/a/ada/investigate/trading $ ./g.exe no problem: 3.33 Exception handled Exception name: CONSTRAINT_ERROR Message: EXCEPTION_INT_DIVIDE_BY_ZERO ... stopped using ctrl-C AWI003@fiw9430 /cygdrive/c/a/ada/investigate/trading $ -- Anders