setjmp/longjmp compatibility with G++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux