Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2007

Tip: Looking for answers? Try searching our database.

/EHa vs. /EHs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PLS - 21 Mar 2007 01:27 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.

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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.