Re: Uncaught exceptions thrown by Cocoa documented anywhere?
Re: Uncaught exceptions thrown by Cocoa documented anywhere?
- Subject: Re: Uncaught exceptions thrown by Cocoa documented anywhere?
- From: John Stiles <email@hidden>
- Date: Fri, 15 Feb 2008 09:14:46 -0800
Bill Bumgarner wrote:
On Feb 15, 2008, at 8:49 AM, Chris Ryland wrote:
What if you're using GC (and wrapping non-Cocoa things with
*MakeCollectable())--is it then safe to use exceptions through Cocoa
frames?
No; it isn't limited to memory management issues. There may be any
number of bits of teardown / cleanup code that will be skipped as the
exception passes over it.
That's always been my problem with exception handling in general. When
everything is working fine, it's great and makes code look simpler. When
a problem actually occurs, I think understanding the flow of control is
extremely difficult if you aren't intimately familiar with the code base.
Unless you are extremely diligent, exceptions can leave your app in a
weird state, with partially-completed things laying around. I know there
are plenty of patterns and techniques for "doing things right," but I
work in a group setting with lots of other developers, and I honestly
don't think it's reasonable to expect them to get every little detail
right—there's too many details that you need to know. (A lot of them
write fairly procedural code to begin with, which is much harder to make
exception-safe than object-oriented code.) It's not too hard to write
code that runs from top to bottom and cleans up after itself as it runs,
but when you consider that, at any point, your code might veer off into
the weeds and get thrown into a different path of execution, suddenly
the cleanup process gets a lot trickier.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden