3 ms·
> 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 AR
by gurkendoktor 13y 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).
- mikeash 13y agoIt doesn't even rely on NSObject. Any root class that provides a compliant implementation of retain, release, and autorelease will work with ARC.
- deleted 13y ago[deleted]
- pjmlp 13y agoNo, it is an hack. Just read this document. https://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226 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.
- astrange 13y agoThe 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.
- mikeash 13y agoWhat part of that is supposed to explain your rather bizarre claim that ARC only works with special Apple libraries?