setjmp/longjmp compatibility with G++
Asfand Yar Qazi
email@asfandyar.cjb.net
Fri Jan 23 09:56:00 GMT 2004
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/
More information about the Gcc-help
mailing list