comp.lang.ada
 help / color / mirror / Atom feed
* Exception handling question
@ 1986-10-02 21:03 Russ Holden
  1986-10-06 17:01 ` Eric Marshall
  1986-10-25  0:24 ` stt
  0 siblings, 2 replies; 6+ messages in thread
From: Russ Holden @ 1986-10-02 21:03 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1986-10-25  0:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-10-02 21:03 Exception handling question Russ Holden
1986-10-06 17:01 ` 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

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