If I understand the difference correctly, when compiling with /EHs
"catch" will only catch objects that were "throw"n. With /EHa, "catch"
will catch thise plus will catch things like addressing exceptions.
When compiling with /EHa, can exceptions like addressing exceptions be
caught as a specific type, like
catch(object &x)
or must they be caught with a generic catch
catch(...)
If so, what is the type for addressing exception? Where do I find the
other C++ objects for system exceptions documented?
Thanks,
++PLS
William DePalo [MVP VC++] - 21 Mar 2007 01:41 GMT
> If I understand the difference correctly, when compiling with /EHs
> "catch" will only catch objects that were "throw"n. With /EHa, "catch"
> will catch thise plus will catch things like addressing exceptions.
The optimizing compiler is smart. In a release build, under /EHs, if it
doesn't see a throw, it may just optimize away the catch clause.
> When compiling with /EHa, can exceptions like addressing exceptions be
> caught as a specific type, like
[quoted text clipped - 4 lines]
> If so, what is the type for addressing exception? Where do I find the
> other C++ objects for system exceptions documented?
The word exception is overloaded. C++ exceptions are different from
structured exceptions used by the o/s to signal things like access
violations and zero divided. My friend Doug explains the difference here
http://members.cox.net/doug_web/eh.htm
Note that often benign conditions are signalled by C++ typed exceptions and
it is often OK to catch one and go on one's way. SE's are almost always a
sign of a programming error. Often the best strategy is to log the error and
quit.
Still, if you find a need to catch an SE and continue, say in the
development phase of a project, I have an example that shows how to do that
at the bottom of this page on my website:
http://www.ivrforbeginners.com/downloads/downloads.htm
Regards,
Will
Ben Voigt - 21 Mar 2007 14:34 GMT
> If I understand the difference correctly, when compiling with /EHs
> "catch" will only catch objects that were "throw"n. With /EHa, "catch"
[quoted text clipped - 8 lines]
> If so, what is the type for addressing exception? Where do I find the
> other C++ objects for system exceptions documented?
You provide your own type. See _set_se_translator in the documentation.