discuss-gnustep
[Top][All Lists]
Advanced

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

Re: does GNUstep support exception as well as apple implementation?


From: Shuduo Sang
Subject: Re: does GNUstep support exception as well as apple implementation?
Date: Sat, 5 Jun 2010 20:00:14 +0800



On Fri, Jun 4, 2010 at 11:45 PM, Lars Sonchocky-Helldorf <lars.sonchocky-helldorf@hamburg.de> wrote:
David,

he said: "I am studying objc these days".

I am afraid your answer is way above his level for now.


@Shuduo:

So I am throwing in this link (not an exception ;-)) to provide some basics:

http://developer.apple.com/mac/library/documentation/cocoa/conceptual/Exceptions/Tasks/HandlingExceptions.html

Here especially compare the paragraphs "Handling Exceptions Using Compiler Directives" (this is what you tried and the so called "modern" form) vs. "Handling Exceptions Using Macros" (scroll down that page for this, this is the "old" or "NeXT-style" implementation)


After checked out above link, I found the flag -fobjc-exceptions was missed in my command line to compile
my code. After applying that flag, everything is okay now.
 

To explain what you experienced: You most likely have a GNU-ObjC-runtime version which only supports the old style exceptions, ask David for how to get the new runtime to work.


regards,

       Lars


Am 04.06.2010 um 15:30 schrieb David Chisnall:

On 4 Jun 2010, at 12:18, Shuduo Sang wrote:

Does it mean the exception implementation of GNUstep is not complete as well as Apple runtime?


There are two implementations of exception handling for use with GNUstep.  One is the old NeXT-style implementation, using setjmp()/longjmp(), which is slow, unsafe, and needs to die a quick and peaceful death.  You may only use this with the NS_DURING family of macros.

The other is DWARF zero-cost exception handling, which uses the same mechanism as the newer GNU C++ ABI and as Apple's modern runtime.  This uses asynchronous unwinding tables and allows cleanup in intervening stack frames irrespective of their language.  This ought to be the default, but I'm not sure if it is.

The catch is that you can not mix the two mechanisms, or you get some problems.  If you are using the @throw stuff, then you are using the DWARF ABI, but if your GNUstep is using the setjmp() mechanism then you may experience problems.

Note that there are several errors and serious omissions in the explanation of the code in the page that you linked to - I haven't read the code example in detail, but if it's written by someone with the same little understanding of the EH mechanism as displayed by the author of the page, then I wouldn't be surprised if it's buggy.

David

-- Sent from my brain


_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep



reply via email to

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