delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/04/20:08:57

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199803050106.AA285699981@typhoon.rose.hp.com>
Subject: Re: gcc 2.8 exception handling
To: djgpp-workers AT delorie DOT com
Date: Wed, 04 Mar 1998 17:06:21 PST
Reply-To: andrewc AT rosemail DOT rose DOT hp DOT com

Could sombody with gcc 2.8 try the following test program?  It should work
as the linux version does.  I think I tried to ask this earlier but 
all my mail was bouncing for a whil and I forgot to resend it.

Thanks

Andy

 	
> void f(int x) throw(int)
> {
> 	if (x > 10)
> 		throw(x);
> 
> 	cout << "f: " << x << endl;
> }
> 	
> int main(void)
> {
> 	try
> 	{
> 		f(5);
> 		f(9);
> 		f(11);
> 	}
> 	catch(int i)
> 	{
>         	cout << "Error: Argument to f() was too large (" << i << ")" << endl;
> 	}
> 	return 0;
> }
> 
> 
> When compiled with the PGCC release based on EGCS 1.0.1 the output is the
> following:
> 
> f: 5
> f: 9
> Abort!
> 
> i.e. when the exception are thrown as 11 is passed to f(), I just get the
> abort message. When compiled with GCC 2.8.0 (under linux) the output is the
> following:
> 
> f: 5
> f: 9
> Error: Argument to f() was too large (11)
> 
> i.e. the expected output (atleast what I expected).














- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019