Re: Exception handling
Re: Exception handling
- Subject: Re: Exception handling
- From: Scott Thompson <email@hidden>
- Date: Thu, 30 Oct 2003 20:54:49 -0600
On Oct 30, 2003, at 1:51 PM, Michael B. Johnson wrote:
Can anyone comment on why this isn't on by default? In other words,
what's the cost (execution speed or app size, or layout in address
space) of enabling this? I'd like to put it on by default for my
stuff, but I'm not sure if there are carrying costs like C++'s
exceptions...
The objective-C language-based exception mechanism is exactly the same
as the mechanism used for the DURING/HANLDER macros. It is a
setjmp/longjmp based scheme. As such it would have the same overhead
as the macro based exceptions. By in large this is a minimal runtime
cost (to set up the setjmp/longjmp frames stack) and a small runtime
memory overhead during execution to hold those frames.
The current gcc implementation of C++ exceptions has a higher
application size impact to store the exception tables and stack
unwinding code, but has virtually no impact on execution speed (until
an exception is thrown).
It is important to note, however, (particularly for Objective-C++
programmers) it is probably unwise to mix the exception mechanisms.
Particularly, with the Objective-C language based exceptions, your C++
stack-based objects will NOT be properly destroyed while the stack
unwinds from an Objective-C language exception.
This can lead to bad problems if you are not aware of it.
Scott
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.