Article View: gnu.gcc.help
Article #143Help with exception handling? GCC 2.1.
From: Zacharias Beckman
Date: Wed, 15 Apr 1992 18:34
Date: Wed, 15 Apr 1992 18:34
38 lines
1491 bytes
1491 bytes
Can anyone tell me why this program:
#include <iostream.h>
class gorp {
public:
gorp() { cout << "gorp created.\n"; }
};
main()
{
try {
f();
}
catch (gorp) {
cout << "caught gorp.\n";
}
}
void f()
{
throw gorp;
}
Fails to compile when using -fansi-exceptions in GCC 2.1, as in:
dolphin% gcc -fansi-exceptions test.cc -o test -Wall -g -O
-I/usr/local/include/libg++ -L/usr/local/lib -lg++
test.cc: In function `int main ()':
test.cc:11: warning: implicit declaration of function `f'
test.cc:17: warning: control reaches end of non-void function
test.cc: In function `void f ()':
test.cc:21: parse error before `;'
As though the "throw" keyword is not recognized? Thanks in advance!
--
Zacharias J Beckman - Lower Code Dweller - Boss Logic Inc - zack@bosslogic.com
To be "matter of fact" about the world is to blunder into fantasy --- and dull
fantasy at that, as the real world is strange and wonderful. -- R. A. Heinlen
Those opinions I express herein are my own, I'm fairly sure. -- Z. J. Beckman
Technical Details
Message-ID:
<1992Apr15.183457.1614@bosslogic.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bosslogic.COM!zackShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bosslogic.COM!zack From: zack@bosslogic.COM (Zacharias Beckman) Subject: Help with exception handling? GCC 2.1. Message-ID: <1992Apr15.183457.1614@bosslogic.com> Sender: gnulists@ai.mit.edu Reply-To: zack@bosslogic.com Organization: Boss Logic Inc. Distribution: gnu Date: Wed, 15 Apr 1992 18:34:57 GMT Lines: 39