• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why do we use -fobjc-arc instead of removing code with #define?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Jean-Daniel Dupas <email@hidden>
  • Date: Sun, 24 Jun 2012 15:14:39 +0200

Le 24 juin 2012 à 07:18, Roland King a écrit :

>
> On Jun 24, 2012, at 12:25 PM, Graham Cox wrote:
>
>>
>> On 24/06/2012, at 1:55 PM, Jerry Krinock wrote:
>>
>>> Why didn't Apple do the same thing for ARC?
>>
>>
>> Because ARC is a compiler technology that inserts -retain, -release automatically and silently into your code as it is compiled. The methods have to be there in order for memory management to work at runtime - ARC doesn't do anything at runtime, by then your code is exactly the same as if you'd written memory management manually (though hopefully without any mistakes!).
>>
>> --Graham
>>
>
> They could still #define them at compile time to be nothing and then insert the code to call the underlying functions just as they do now, that inserts objc_release() and other calls directly into the compiled code anyway. There's no incompatibility there. My guess is that Apple wanted to move totally away from manual retain/release and have people not even see it, so instead of #defining out the calls, they wrote the conversion tool which removes them entirely, and does a few other things too, a clean-break approach.

The less the compiler has too make assumption, the better.
Converting code from manual ref counting to ARC is mostly doable automatically, but not always. So, instead of trying to do it each time you compile a file, Apple force you to do it once and for all (using the ARC migration assistant), and then don't have to include all the migration logic in the compiler.

-- Jean-Daniel





_______________________________________________

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


References: 
 >Why do we use -fobjc-arc instead of removing code with #define? (From: Jerry Krinock <email@hidden>)
 >Re: Why do we use -fobjc-arc instead of removing code with #define? (From: Dave DeLong <email@hidden>)
 >Re: Why do we use -fobjc-arc instead of removing code with #define? (From: Jerry Krinock <email@hidden>)
 >Re: Why do we use -fobjc-arc instead of removing code with #define? (From: Graham Cox <email@hidden>)
 >Re: Why do we use -fobjc-arc instead of removing code with #define? (From: Roland King <email@hidden>)

  • Prev by Date: Re: Sandboxing and calling Launchctl
  • Next by Date: Re: False positive on writeToURL:atomically:encoding:error: ?
  • Previous by thread: Re: Why do we use -fobjc-arc instead of removing code with #define?
  • Next by thread: Re: Why do we use -fobjc-arc instead of removing code with #define?
  • Index(es):
    • Date
    • Thread