Re: Exceptions not caught by catch(...)
Re: Exceptions not caught by catch(...)
- Subject: Re: Exceptions not caught by catch(...)
- From: "Michael Williamson" <email@hidden>
- Date: Tue, 23 Dec 2008 17:01:15 +1100
Thanks for the explanation.
For my understanding, you're saying we can't just assume that it's possible to throw exceptions through all libraries?
It seems there are some libraries that we can, so is there a way to know?
e.g. I'm using a few 3rd party libraries, and throwing other exceptions through them hasn't caused me any issues yet.
They all throw their own exceptions. I'm wondering if we can take that to mean it's possible to throw external exceptions through them?
(whether it's "safe" depends on their code being exception safe)
And if I understand you correctly, the result of throwing exceptions through a library that simply isn't built for it is basically undefined?
In my case it was that terminate was called instead of the catch(...) being hit. But it could easily have been some other crash or random behaviour?
Thanks again,
Michael
On Tue, Dec 23, 2008 at 2:04 PM, glenn andreas
<email@hidden> wrote:
On Dec 22, 2008, at 8:06 PM, Michael Williamson wrote:
Short Summary: exceptions are failing to be caught in main, and this includes with a catch(...). After some testing, it looks like the problem only occurs when I'm going through some Carbon event handlers (SendEventToEventTarget and related).
If I trigger the same exception when bypassing this, the exceptions are caught correctly in main.
I've seen reference to the gcc visibility issue with exceptions, but I would have thought catch(...) should avoid that. Plus I've compiled all of this with gcc 4.2 (via XCode 3.1) which I believe has solved that issue?
Any ideas what could cause this?
You can't throw exceptions through the toolbox (or in general, you can't throw exceptions through any library that you didn't compile).
Exception throwing assumes that there is information for stack winding available - the frameworks in general don't, so the stack winding, at best, won't work (and will often crash), and potentially can cause bad things to happen (consider a library compiled with its own exception handling from a previous version of the compiler/runtime that has slightly different fields).
JSXObjC | the easy way to unite _javascript_ and Objective C
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden