View Single Post
  #9 (permalink)  
Old 09-07-2009, 11:56 AM
Kenneth Porter
Guest
 
Posts: n/a
Default Re: Porting issues: Visual Studio and gcc

Andrew <marlow.andrew@googlemail.com> wrote in news:2ae3f600-75ca-4398-
8b8f-2f8de0b42d18@o41g2000yqb.googlegroups.com:

> Yes. The Microsoft compilers turn SEGV etc into C++ exceptions. This
> means that catching exceptions by the base class will inadvertantly
> catch these cases.


What's the problem here?

Doesn't that happen only if you explicitly catch those exceptions? (Or
implicitly, via a ... catch.) If your code catches only exceptions that
it's interested in, these "hardware" exceptions should percolate past it,
up to (and possibly out of) the thread. Is this any different from a low-
level library throwing an undocumented exception? (In this case, the
hardware is the "low level library" that's throwing the exception.)

My code does put a final catch around each thread and main to insure that
the user sees any unexpected exceptions (to report back to me). It first
tries to catch std::exception and then "...". Popping up my own messagebox
is more informative than depending on the MS one. I don't know how the gcc
runtime or various Linux windowing environments handle unhandled
exceptions. Their reporting might be good enough to let the exception go to
them. For a "headless" application (eg. in an embedded appliance), the
final catch can log the exception for post-mortem.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Reply With Quote