> On Jun 13, 2018, at 7:53 PM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> The situation with C++ exceptions is a bit different. 

It's actually exactly the same, since at the runtime level Obj-C exceptions are 
C++ exceptions.

> I really think you have exactly 2 error handling patterns:
> 1. Returning false/nil with an outError parameter for recoverable errors, and 
> always testing the result at every level.
> 2. Throwing NSExceptions for unrecoverable errors, and letting the app crash 
> immediately.

You can throw exceptions (C++ or NSException) in your own code, provided that 
you catch and handle them before they unwind into system code*. (We use that 
approach in the C++ core code of the Cocoa framework I work on.)

—Jens

* well, libc++ is fine of course since it's exception-aware.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to