The C ++ standard gives nothing to work with Undefined Behavior. Even if MS does. This is a specific platform - so be careful. Some floating point exceptions refer to Win32 exceptions that you can try to catch with _set_se_translator() . The problem is that you can catch Win32 exceptions, but then your stack will not spin up properly. At least that's not what you can put your life on. What is the futility of the exercise.
Update: The exception is intentionally checked for stack expansion. The question is why the Wrapper class destructor is not called. - Naven
If so, do not do this. There are better ways to throw exceptions than through Undefined Behavior.
eg:
void OnRecvBuffer() { try { Wrapper a("AddRef"); throw 42;
You cannot dereference a NULL pointer. You invoke Undefined Behavior here:
One* p = NULL; p->x = 10;
After this line, all bets are disabled, and you could have killed all of us;)
p is a pointer to a One object. It must contain the address of the One object. You initialized it to 0 - the object has no address 0. 0 is not a valid address for any object (this is confirmed by the standard).
source share