comp.lang.ada
 help / color / mirror / Atom feed
From: holden@cca.UUCP (Russ Holden)
Subject: Exception handling question
Date: Thu, 2-Oct-86 17:03:50 EDT	[thread overview]
Date: Thu Oct  2 17:03:50 1986
Message-ID: <10377@cca.UUCP> (raw)


The following language fragment (in a slightly different
form) was written here (really!).  It was found to
perform differently on the Rational and VAX/VMS compilers.  
On the Rational "Missed it" is printed while on VMS 
"Got it" is printed.

Logic and the LRM both seem to indicate that the innermost
handler should get control and "Got it" should be printed.
Section 11.4 says that "The selection of this handler depends
on whether the exception is raised during the execution of
statements or during the elaboration of declarations".  It
says nothing about whether the exception is raised with
using a "raise" or a "raise <exception_name>" as some here
have claimed.  Is this right? 

with Textio;

procedure Foo is
   Bar : exception;
begin
    begin
        begin
            raise Bar;
        exception
            when Bar =>
                begin
                    raise;
                exception
                    when Bar =>
                        Textio.Put_Line("Got it");
                end;
        end;
    exception
        when Bar =>
            Textio.Put_Line("Missed it");
    end;
end Foo;
-- 
Russell Holden
Computer Corporation of America
Four Cambridge Center
Cambridge, MA 02142

             reply	other threads:[~1986-10-02 21:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-10-02 21:03 Russ Holden [this message]
1986-10-06 17:01 ` Exception handling question Eric Marshall
1986-10-07 19:40   ` John B. Goodenough
1986-10-09 13:38     ` Eric Marshall
1986-10-13 11:21       ` Jan Kok
1986-10-25  0:24 ` stt
replies disabled

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