comp.lang.ada
 help / color / mirror / Atom feed
From: Anders Wirzenius <anders@no.email.thanks.invalid>
Subject: Re: Ada exception block does NOT work?
Date: Wed, 17 Aug 2005 11:34:10 GMT
Date: 2005-08-17T11:34:10+00:00	[thread overview]
Message-ID: <uvf24ztjf.fsf@no.email.thanks.invalid> (raw)
In-Reply-To: 87hddou95a.fsf@tiscali.be

Ludovic Brenta <ludovic.brenta@tiscali.be> 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



  reply	other threads:[~2005-08-17 11:34 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-16  8:48 Ada exception block does NOT work? bubble
2005-08-16  9:00 ` Georg Bauhaus
2005-08-16  9:32   ` bubble
2005-08-16  9:42     ` gautier_niouzes
2005-08-16 15:25       ` Frank J. Lhota
2005-08-16 16:58         ` Svesse
2005-08-16 17:48           ` Björn Persson
2005-08-16 18:12             ` Svesse
2005-08-16 18:17           ` Frank J. Lhota
2005-08-17 10:53         ` Ludovic Brenta
2005-08-17 11:34           ` Anders Wirzenius [this message]
2005-08-17 18:08             ` Björn Persson
2005-08-17 19:05               ` Randy Brukardt
2005-08-18 15:58               ` Georg Bauhaus
2005-08-16 12:30     ` Georg Bauhaus
2005-08-16 17:39       ` Björn Persson
2005-08-16 19:43         ` Georg Bauhaus
2005-08-17  1:39     ` Jeffrey R. Carter
2005-08-17  7:22       ` Maciej Sobczak
2005-08-18  1:05         ` Jeffrey R. Carter
2005-08-18  8:44           ` Maciej Sobczak
2005-08-18 11:40             ` Jean-Pierre Rosen
2005-08-18 12:56               ` Maciej Sobczak
2005-08-18 14:42                 ` Jean-Pierre Rosen
2005-08-18 18:03                 ` Martin Krischik
2005-08-18 13:15               ` Alex R. Mosteo
2005-08-18 15:23                 ` Dmitry A. Kazakov
2005-08-18 18:00                 ` Martin Krischik
2005-08-18 16:13             ` Jeffrey Carter
2005-08-18 16:38               ` Hyman Rosen
2005-08-18 18:07                 ` jimmaureenrogers
2005-08-18 18:44                   ` Hyman Rosen
2005-08-18 20:52                     ` Frank J. Lhota
2005-08-19  0:57                     ` jimmaureenrogers
2005-08-19  7:52                       ` Dmitry A. Kazakov
2005-08-19 14:41                       ` Robert A Duff
2005-08-19 17:48                   ` Martin Krischik
2005-08-19 14:58                 ` Robert A Duff
2005-08-18 17:54             ` Martin Krischik
2005-08-18 20:56             ` Robert A Duff
2005-08-18 22:01               ` Hyman Rosen
2005-08-19  2:35               ` Jeffrey R. Carter
2005-08-20 15:28                 ` Robert A Duff
2005-08-20 20:24                   ` Jeffrey R. Carter
2005-08-20 21:34                     ` Robert A Duff
2005-08-20 22:47                       ` Frank J. Lhota
2005-08-20 23:34                         ` Robert A Duff
2005-08-21 11:18                           ` Simon Wright
2005-08-21 16:59                             ` tmoran
2005-08-21 19:48                               ` Simon Wright
2005-08-21 16:07                           ` Frank J. Lhota
2005-08-21 16:23                           ` Martin Krischik
2005-08-21  1:12                       ` Björn Persson
2005-08-21  9:01                       ` Dmitry A. Kazakov
2005-08-21 16:14                       ` Martin Krischik
2005-08-21  4:02                     ` Larry Kilgallen
2005-08-19 12:34               ` Dr. Adrian Wrigley
2005-08-19 17:29                 ` Martin Krischik
2005-08-19 18:14                   ` Frank J. Lhota
2005-08-21 16:02                     ` Martin Krischik
2005-08-21 16:48                       ` Frank J. Lhota
2005-08-22 15:51                         ` Martin Krischik
2005-08-23  0:32                       ` Larry Elmore
     [not found]                         ` <h5dlg1tsie8n3ikirvbi508t9afobhctkj@4ax.com>
2005-08-23 18:09                           ` Martin Krischik
2005-08-23 19:50                             ` C history Björn Persson
2005-08-27 21:09                             ` Ada exception block does NOT work? Dave Thompson
2005-08-24  1:07                           ` Larry Elmore
2005-08-24  2:36                             ` Jeffrey R. Carter
2005-08-25  0:14                               ` Larry Elmore
2005-08-26  2:44                                 ` Jeffrey R. Carter
2005-08-24 16:44                             ` Martin Krischik
2005-08-22  8:12                     ` Hyman Rosen
2005-08-18 21:15             ` Robert A Duff
2005-08-19 12:00               ` Dmitry A. Kazakov
2005-08-17 20:24 ` Simon Wright
2005-08-18 19:36   ` Björn Persson
2005-08-18 21:07     ` Simon Wright
2005-08-22 10:47 ` bubble
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox