delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1998/02/10/20:08:14

X-pop3-spooler: POP3MAIL 2.1.0 b 3 961213 -bs-
Delivered-To: pcg AT goof DOT com
Message-Id: <3.0.16.19980210204353.35c74038@hem1.passagen.se>
X-Sender: blizzar AT hem1 DOT passagen DOT se (Unverified)
X-Mailer: Windows Eudora Pro Version 3.0 (16)
Date: Tue, 10 Feb 1998 20:43:58 -0500
To: andrewc AT rosemail DOT rose DOT hp DOT com
From: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
Subject: Re: PGCC for DOS and exception handling!?
Cc: beastium-list AT Desk DOT nl
Mime-Version: 1.0
Sender: Marc Lehmann <pcg AT goof DOT com>
Status: RO
Lines: 67

At 10.25 1998-02-10 PST, you wrote:
>> Doesn't EGCS-1.0.1 support exceptions when ported to DOS (or at all)?
>Uh - exception handling?  Whats that?

Well, it's a c++ feature for easier "error-handling" or "exception-handling".


>> Whenever a program throws an exception my program exits with the "Abort!"
>> message!
>> (The same program works fine with GCC 2.8.0 under linux).
>Can you put together a small source sample for me to try?  I really
>don't know c++ (I assume this is c++ we are talking about) at all.

Yes, you are correct, it's c++.

Here's the source I compiled:

#include <iostream.h>
	
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).

Greatful for any replies.
-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --

*****************************************************
* A brief description of DJGPP:                     *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************

- Raw text -


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