This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
egcs and ios::failure
- To: egcs at cygnus dot com
- Subject: egcs and ios::failure
- From: "Peter Garner" <peter dot garner at toward dot com>
- Date: Thu, 2 May 96 00:25:14 EDT
- CC: bothner at cygnus dot com
- Reply-To: <peter dot garner at toward dot com>
Good Day all!
I recently downloaded egcs-19980425 since I would like an
ISO C++ compiler. To get the right file errors, I patched
streambuf.h and streambuf.cc so that it would throw an
ios::failure exception (that class being a child of
exception per the ISO draft.) When I attempt to use this I
get a segmentation fault. I thought you might like to see
this. I have attached a file "test.tar" that contains the
difference between the original and patched h file
(hdiff.txt) and the difference between the original and
patched cc file (ccdiff.txt) and fexcptst.cpp, a simple
program that tests / causes the segmentation fault.
Lastly, please pardon me, but I noticed that the original
threw an exception by pointer. In general isn't that a
very bad idea? I was always taught to write a copy
constructor for all exceptions and always throw by value,
never by new. Doesn't a construct like :
throw new failure ( this )
lead to a memory leak since it becomes the responsibility
of the catch block to delete the pointer?
Thanks
Peter
test.tar