comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: How to get nice with GNAT?
Date: Sun, 23 Nov 2014 13:49:34 -0700
Date: 2014-11-23T13:49:34-07:00	[thread overview]
Message-ID: <m4th8h$jce$1@dont-email.me> (raw)
In-Reply-To: <dda292cb-97ac-4ab5-b29d-b3c0ec232c5b@googlegroups.com>

On 11/23/2014 10:41 AM, brbarkstrom@gmail.com wrote:
> 
> I'm working in GNAT GPL, so my suggestion may not work with every
> compiler.
> 
> On the other hand, in my code, the if following the exception in the
> procedure is picked up and executed properly.  The code doesn't act
> like the program has to fail if any exception is raised.

I don't think you're talking about exceptions. I took this program:

with Ada.Text_IO;
procedure Boolean_Exception is
   procedure Test (OK : out Boolean) is
      -- empty declarative part
   begin -- Test
      OK := False;

      raise Constraint_Error;
   end Test;

   OK : Boolean := True;
begin -- Boolean_Exception
   Test (OK => OK);
   Ada.Text_IO.Put_Line (Item => "No exception");
exception -- Boolean_Exception
when others =>
   Ada.Text_IO.Put_Line (Item => Boolean'Image (OK) );
end Boolean_Exception;

compiled with GNAT 4.6 on Linux, and got:

$ gnatmake -gnatwa -gnatano -O2 -fstack-check boolean_exception.adb
gcc-4.6 -c -gnatwa -gnatano -O2 -fstack-check boolean_exception.adb
boolean_exception.adb:6:10: warning: assignment to pass-by-copy formal may have
no effect
boolean_exception.adb:6:10: warning: "raise" statement may result in abnormal
return (RM 6.4.1(17))
gnatbind -x boolean_exception.ali
gnatlink boolean_exception.ali -O2 -fstack-check
$ ./boolean_exception
TRUE

What you're talking about doesn't work with GNAT.

-- 
Jeff Carter
"This school was here before you came,
and it'll be here before you go."
Horse Feathers
48


  parent reply	other threads:[~2014-11-23 20:49 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 11:41 How to get nice with GNAT? Natasha Kerensikova
2014-11-21 12:42 ` Björn Lundin
2014-11-21 22:55 ` Randy Brukardt
2014-11-21 23:13   ` Björn Lundin
2014-11-22  9:45   ` How to get nice traceback " Natasha Kerensikova
2014-11-22  9:57     ` Dmitry A. Kazakov
2014-11-24 22:35     ` Randy Brukardt
2014-11-22 10:11 ` How to get nice " gautier_niouzes
2014-11-22 10:40   ` Natasha Kerensikova
2014-11-22 22:44 ` brbarkstrom
2014-11-22 23:24   ` Jeffrey Carter
2014-11-23 18:06   ` Björn Lundin
2014-11-23 16:13 ` brbarkstrom
2014-11-23 16:18   ` J-P. Rosen
2014-11-23 17:02   ` Jeffrey Carter
2014-11-23 17:41 ` brbarkstrom
2014-11-23 19:22   ` Simon Wright
2014-11-23 20:49   ` Jeffrey Carter [this message]
2014-11-24  3:05     ` brbarkstrom
2014-11-24  6:25       ` Jeffrey Carter
2014-11-24 14:39         ` brbarkstrom
2014-11-24 17:42       ` Dennis Lee Bieber
2014-11-25 13:45         ` brbarkstrom
2014-11-25 15:07           ` ake.ragnar.dahlgren
2014-11-25 15:51             ` brbarkstrom
2014-11-25 16:52             ` Jeffrey Carter
2014-11-25 19:18             ` G.B.
2014-11-25 20:47               ` brbarkstrom
2014-11-25 22:12             ` Randy Brukardt
2014-11-25 23:30               ` Simon Wright
2014-11-26  1:25                 ` G.B.
2014-11-26  7:35                   ` Simon Wright
2014-11-26 11:55                     ` Georg Bauhaus
2014-11-26 13:06                       ` Dmitry A. Kazakov
2014-11-26 13:36                         ` brbarkstrom
2014-11-26 21:27                         ` Randy Brukardt
2014-11-26 22:38                           ` brbarkstrom
2014-11-27  9:01                             ` Dmitry A. Kazakov
2014-11-27 13:53                               ` brbarkstrom
2014-11-27 17:19                                 ` Dmitry A. Kazakov
2014-12-01 22:25                                   ` Randy Brukardt
2014-12-02  8:42                                     ` Dmitry A. Kazakov
2014-12-03 21:41                                       ` Randy Brukardt
2014-12-06 12:02                                         ` Dmitry A. Kazakov
2014-12-08 22:45                                           ` Randy Brukardt
2014-12-09  8:51                                             ` Dmitry A. Kazakov
2014-12-09 23:14                                               ` Brad Moore
2014-12-09 17:59                                                 ` Dmitry A. Kazakov
2014-11-27  8:52                           ` Dmitry A. Kazakov
2014-11-26  6:18                 ` J-P. Rosen
2014-11-26  7:37                   ` Simon Wright
2014-11-26  8:41               ` Dmitry A. Kazakov
2014-11-25 18:33           ` Dennis Lee Bieber
2014-11-26  1:27             ` Dennis Lee Bieber
2014-11-26  3:29               ` brbarkstrom
2014-11-23 18:55 ` brbarkstrom
2014-11-23 19:30 ` brbarkstrom
2014-11-23 22:38   ` Simon Wright
2014-11-24  2:47     ` brbarkstrom
replies disabled

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