🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.ada
Article #992

Exception handling question

#992
From: Russ Holden
Date: Thu, 02 Oct 1986 21:03
43 lines
1719 bytes
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
Technical Details
Message-ID: <10377@cca.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!think!nike!ll-xn!adelie!mirror!cca!holden

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!think!nike!ll-xn!adelie!mirror!cca!holden
From: holden@cca.UUCP (Russ Holden)
Newsgroups: net.lang.ada
Subject: Exception handling question
Message-ID: <10377@cca.UUCP>
Date: Thu, 2-Oct-86 17:03:50 EDT
Article-I.D.: cca.10377
Posted: Thu Oct  2 17:03:50 1986
Date-Received: Sat, 4-Oct-86 10:07:03 EDT
Organization: Computer Corp. of America, Cambridge
Lines: 43