Re: Xcode Release vs Debug Differences: Problem with Exception Types
Re: Xcode Release vs Debug Differences: Problem with Exception Types
- Subject: Re: Xcode Release vs Debug Differences: Problem with Exception Types
- From: Matthew Tobiasz <email@hidden>
- Date: Tue, 17 Jun 2008 12:55:02 -0600
- Resent-date: Tue, 17 Jun 2008 12:56:49 -0600
- Resent-from: Matthew Tobiasz <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: Xcode Mailing List <email@hidden>
I've reproduced this issue in a completely new project, started from scratch. Here's exactly what I did.
- Created a new "Carbon Framework" project call "FooExceptionIssue". - Created two classes in the : FooException and Bar. Here's the source: FooException.h
#include <exception>
class FooException : public virtual std::exception {
public: FooException() throw () : std::exception() { return; } ~ FooException() throw () { return; }
virtual const char* what() const throw() { return "FooException"; } }; Bar.h
#include "FooException.h"
class Bar {
public: Bar(){ return; } ~Bar(){ return; }
inline void inlineMethodThrow() throw (FooException) { throw FooException(); }
void methodThrow() throw (FooException); }; Bar.cpp
#include "Bar.h"
void Bar::methodThrow() throw (FooException) { throw FooException(); }
- Set the FooException.h and Bar.h to have a role of "public" (so their headers will be included publicly in the built framework). - Created a new "BSD Shell Tool" Target called "Example" - Created another file Example.cpp that's part of the Example target not , here's the source: Example.cpp
#include <iostream> #include <FooExceptionIssue/Bar.h> #include <exception>
int main(){ Bar bar;
try{ bar.inlineMethodThrow(); }catch(FooException&){ std::cout << "Caught FooException on inlineMethodThrow()\n"; }catch(std::exception&){ std::cout << "Caught std::exception on inlineMethodThrow()\n"; }
try{ bar.methodThrow(); }catch(FooException&){ std::cout << "Caught FooException on methodThrow()\n"; }catch(std::exception&){ std::cout << "Caught std::exception on methodThrow()\n"; }
return 0; }
-Added the FooExceptionIssue target as a dependency of Example, and added FooExceptionIssue.framework to the "Link Binary with Library" step in Example. - Ran the application. Here's the output when built and run in Release: Caught FooException on inlineMethodThrow() Caught std::exception on methodThrow()
And here's Debug: Caught FooException on inlineMethodThrow() Caught FooException on methodThrow()
-Note: No build settings were changed. The only things I did were listed above.
Any ideas why I've observing this kind of behavioural discrepancy between Release and Debug? It seems that Debug is exhibiting the correct behaviour here. Is anyone else getting this kind of thing?
|
_______________________________________________
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