Re: Which exception handling system should I use?
Re: Which exception handling system should I use?
- Subject: Re: Which exception handling system should I use?
- From: Derrick Bass <email@hidden>
- Date: Mon, 24 Apr 2006 13:05:49 -0700
On Apr 24, 2006, at 7:38 AM, Ondra Cada wrote:
+ more convenient (@finally, can 'return' out)
+ more safe ('return' out won't fail)
- has to be explicitly switched on
- not portable to older systems
- problem with breaking at (objc_exception_throw can be used, but
unlike raise, there's no guarantee for future)
+ allows to throw any object (not necessarily an NSException--if
doing so, beware compatibility with older code!)
- does not allow dynamic expansion (you cannot override
objc_exception_throw by subclass/category/poseAsClass).
If you are using Objective-C++ then there is another minus to @try:
- marks variables in the subroutine with the @try block as volatile
C++ won't allow you pass a reference or pointer to a volatile object
to a function that doesn't explicitly say it can accept volatile
objects (this includes member functions); so you end up having to do
a lot of casting to get the code to compile.
I haven't quite figured out the pattern to this; some variables seem
to get marked volatile and some not. The volatileness is not confined
within the @try block; it affects all the code that follows the
block. Why variables are marked as volatile in the first place, I
have no idea. Maybe someone can explain that.
Derrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden