This is the mail archive of the gcc-help@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]
Other format: [Raw text]

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/


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