Comment by gurkendoktor

13 years ago

> Apple's ARC is a compiler hack. It only works if you happen to use set of Cocoa libraries that are recognized by the compiler

I don't understand. How does ARC rely on more than what NSObject provides? I'm coming from the C++ shared_ptr world and ARC does not feel much different so far (less explicit, but easier to optimise).

No, it is an hack.

Just read this document.

https://developer.apple.com/library/mac/#releasenotes/Object...

You need to write code with lots of special cases to be able to have ARC active and not fall into strange compiler errors.

  • The compiler errors are actually quite clear.

    Most of the restrictions (bridge casts and naming methods) are interoperation with non-ARC code, and from working on Java/JNI I can assure you GC<>manual interaction was worse.

    It is of course still quite possible to get abandoned memory through retain cycles.

  • What part of that is supposed to explain your rather bizarre claim that ARC only works with special Apple libraries?

    • > The compiler understands Objective-C methods that return Core Foundation types follow the historical Cocoa naming conventions

      1 reply →

It doesn't even rely on NSObject. Any root class that provides a compliant implementation of retain, release, and autorelease will work with ARC.