3 ms·
Actually, it looks like C++ destructors don't run on longjmp either, though that's less of an issue since C++ actually has real exceptions.
by dllthomas 13y ago
Actually, it looks like C++ destructors don't run on longjmp either, though that's less of an issue since C++ actually has real exceptions.
- mpyne 13y agolongjmp is what the library and standards writers refer to as a "non-local goto" so it's kind of to be expected that it would manage to bypass destructors (I'm not sure how you'd unwind the stack enough to ensure that you've destructed everything created since the corresponding setjmp).
- dllthomas 13y agoIt's not terribly surprising, but it is worth noting since one use of setjmp/longjmp is to implement exceptions, and one would expect (and desire) destructors to run when unwinding on exceptions.