Re: Exceptions not caught by catch(...)
Re: Exceptions not caught by catch(...)
- Subject: Re: Exceptions not caught by catch(...)
- From: glenn andreas <email@hidden>
- Date: Tue, 23 Dec 2008 09:05:16 -0600
On Dec 23, 2008, at 12:01 AM, Michael Williamson wrote: 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?
Unless you built them (or know that they are built using a C++ compiler that generates exceptions that are compatible with your compiler), you can't assume.
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)
If they were built with a different version of gcc (or a different compiler) they may not generate the same format "stack unwinding" data, which can cause crashes, etc...
And if I understand you correctly, the result of throwing exceptions through a library that simply isn't built for it is basically undefined?
Exactly. 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?
Yup. Since C++ is very "compiler/runtime version dependent" this even means that if you get a C++ object library and write a subclass of one of the classes in the library, you can have problems if they aren't done with the same compiler (since the library code will have vtables with one layout, and the ones you generate will be in a different layout). RTTI has similar problems.
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