lauch2 said:
You are welcome.
Do you mean that it just needs to remove the complier option /O2 in a
default setting for the release build?
No. The difference in behavior that you experience between the release and
debug builds does stem from the fact that the compiler removes the guard
around the protected section and the exception handler as an optimization.
But it would be akin to throwing the baby out with the bath water if you
were to remove optimizations in a release build to get the debug exception
handling behavior.
As Carl has already pointed out, if you must comingle structured and typed
exceptions then you must use _set_se_translator(). I can post an example
that does that if you need help.
But you must realize that catching the exception is no panacea. It is
possible that a program's state has been so trashed by the time that a
structured execption gets thrown that it is better, for example, to report
the error, create a minidump and exit.
IMO, in development, _set_se_translator() is useful, especially so since the
exception record for structured exceptions includes the address of the bad
code. But later, you really should not confuse structured exceptions which
are almost always evidence of serious programming errors and C++ typed
exceptions which are almost always more benign.
Regards,
Will