This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
setjmp/longjmp compatibility with G++
- From: Asfand Yar Qazi <email at asfandyar dot cjb dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 23 Jan 2004 10:02:14 +0000
- Subject: setjmp/longjmp compatibility with G++
Hi,
Just wondering, if I do a:
std::set_new_handler(std::terminate)
I won't have to worry about a std::bad_alloc being thrown when I do a
'new ...' or a 'new(nothrow) ...', right?
Its just that I'm writing a Ruby extension, and I tried wrapping C++
code in a generic exception-catching net, but it broke (I got all sorts
of wierd and not-so-wonderful errors.) It seems that Ruby uses
setjmp/longjmp for exceptions, and that is incompatible with the G++
3.2.2 way. Oh well...
Also, I think that if C++ code longjmps back into C/Ruby space, objects
allocated on the stack in the C++ function won't have their destructors
called, is this correct? (Heap objects have a destruction function
associated with them, so they aren't a problem.)
Any ideas on how to sort this problem, or work around it?
Thanks in advance,
Asfand Yar
--
http://www.it-is-truth.org/