On 27 Sep 2019, at 14:19, Turtle Creek Software via Cocoa-dev wrote:

It makes sense that Cocoa programmers much prefer ARC to MRC. Doing it
manually is easy to break and hard to debug. However, the fact that ARC is
not exception-safe concerns me.

Cocoa in general is not exception safe as the policy is to only use exceptions for programmer errors such as accessing an array with an invalid index, therefore any exception thrown in production is likely to cause problems, leaking an object, which is the effect of ARC’s lack of exception safety, is not going to make much of a difference.

You can however make ARC exception safe by passing `-fobjc-arc-exceptions` to clang (default for Objective-C++ code).

It suggests that Cocoa still manages ref counts manually, somewhere under the hood.

The compiler will insert retain/release calls where necessary, so yes, retain counts are still used, as with your smart pointers in C++, it’s effectively just compiler generated constructor/destructor code to perform the retain/release (with a few optimizations).
_______________________________________________

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