4 ms·
Isn't that similar to ARC in Objective-C?
by kuon 12y ago
Isn't that similar to ARC in Objective-C?
- mcphage 12y agoARC is (almost) purely automatic. You write your code however, and then a code analyzer goes through it to figure out where to put the memory management calls. (Also I'm pretty sure ARC still just does reference counting).
- Joky 12y agoARC stands for Automatic Reference Counting: http://en.wikipedia.org/wiki/Automatic_Reference_Counting http://en.wikipedia.org/wiki/Automatic_Reference_Counting
- pixelglow 12y agoEssentially, yes. In ARC, all strong pointers may have multiple owners. In C++11 RAII, the typical, defining use is for single owners (std::unique_ptr) but multiple owners are supported too (std::shared_ptr). In ARC, local pointers may be reclaimed before their scope ends, if the compiler determines no further use of the pointer. In C++11 RAII, all such resources are reclaimed only at scope end. ARC is not exception-safe by default, you have to compile with -fobjc-arc-exceptions to make it exception safe; however Apple standards have been moving away from using exceptions for recoverable conditions for some time now. C++11 RAII is of course exception-safe by default, it's one of the rationales behind the technique.