discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't mix native exceptions and ObjC++


From: David Chisnall
Subject: Re: Can't mix native exceptions and ObjC++
Date: Sat, 13 Mar 2010 13:17:23 +0000

On 13 Mar 2010, at 10:12, Isamu Mogi wrote:

> Hi
> 
> This is a bug in GCC.
> 
> obj-c++.dg/try-catch-[29].mm (objc exceptions are broken) fails with the GNU
> Runtime
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23616

This is a compiler bug, not a runtime bug.  Objective-C++ is unmaintained in 
GCC and is known to be broken.  It is not shipped by default on a number of 
platforms for this reason.  If you use it and stuff breaks, don't expect any 
sympathy.  You should be surprised if it works at all for any code, not that it 
breaks for some.

I can confirm that this test case works correctly with clang.  I don't believe 
that you can catch both ObjC and C++ exceptions in the same stack frame yet, 
but catching just one works correctly (it's a bit tricky catching both; you'd 
need another personality function that can handle the unwinding stuff).  

> Quick and dirty fix here:
> 
> #define NS_HANDLER     } @catch (id) {                                    \
>                           NSException* localException =                  \
>                               [NSException exceptionWithName:@"Unknown"  \
>                                                       reason:@"Unknown"  \
>                                                     userInfo:nil];       \


This 'fix' prevents you from catching any Objective-C exceptions in ObjC++ 
code.  It's better to describe it as 'a different kind of complete breakage' 
than a 'fix.'

David

-- Sent from my PDP-11



reply via email to

[Prev in Thread] Current Thread [Next in Thread]