🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Russ Holden Thu, 02 Oct 1986 21:03
Exception handling question
#992
Author: 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
Re: Exception handling question
#1001
Author: Eric Marshall
Date: Mon, 06 Oct 1986 17:01
29 lines
1330 bytes
	I tried the same program on three validated compilers
we have in house and have included the results. For reasons I
will not discuss, I am unable to release the names of the compilers.
Here are the results:

	1) One compiler flagged the 'raise;' statement as an error,
	   and provided a reference to LRM paragraph 11.3.3. Changing
	   the statement to 'raise Bar;', the generated program printed
	   Got it.

	2) One program printed Missed it.

	3) One program aborted due to an unhandled exception.


	This program sounds like a good candidate for future ACVC's.
-- 


Eric Marshall
System Development Corporation, a Burroughs Company
P.O. Box 517
Paoli, PA. 19301
(215) 648-7223

USENET: sdcrdcf!burdvax!eric
        {sjuvax,ihnp4,akgua,cadre}psuvax1!burdvax!eric
ARPANET: PAYTON@BBNG
Re: Exception handling question
#1028
Author: stt
Date: Sat, 25 Oct 1986 00:24
12 lines
996 bytes
I don't agree with your conclusion.  Things are generally legal
if not specifically disallowed in cases like this, so
"raise;" inside of a nested block, loop, if, case, etc. is perfectly
legal.  It is only illegal when inside a nested unit/accept statement.
Similar rules apply to return, exit <name>, etc., and these
are certainly legal inside nested blocks (see 5.7, 5.8, 5.9).

S. Tucker Taft
c/o Intermetrics, Inc.
733 Concord Ave
Cambridge, MA  02138
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads