Re: Why do we use -fobjc-arc instead of removing code with #define?
Re: Why do we use -fobjc-arc instead of removing code with #define?
- Subject: Re: Why do we use -fobjc-arc instead of removing code with #define?
- From: Greg Parker <email@hidden>
- Date: Mon, 25 Jun 2012 14:42:11 -0700
On Jun 23, 2012, at 8:55 PM, Jerry Krinock <email@hidden> wrote:
> But now I wonder why Apple did not do this, as they did with Garbage Collection. Methods -retain, -release, and -autorelease are no-ops when GC is on.
>
> Why didn't Apple do the same thing for ARC?
Objective-C garbage collection supported a hybrid mode, where the same binary could run with or without GC enabled. Such code was written with retain/release calls in place, but those calls were ignored if you were running with GC on. This hybrid mode was used in system libraries and other code that needed to run in both GC and non-GC apps.
The problem with hybrid mode is that it is difficult to keep both modes functioning. If you have retain/release statements that are ignored, and you are not truly fanatical about testing both modes, then in short order you will find that your retain/release statements are incorrect because of subsequent code changes.
ARC has no need for GC's hybrid mode, because ARC code and non-ARC code are fully interoperable. We recommend each file be written for either one or the other, with no attempt to be ARC-agnostic.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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