This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs and ios::failure


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]