News for hackers. Stuff that matters.
Re:A Garbage Collector for C and C++ by andrewchambers on Friday July 10, 2015 @03:15AM (#9862677)
Don't you know about the std:: smart pointers?
Re:A Garbage Collector for C and C++ by antimagic on Friday July 10, 2015 @05:04AM (#9862944)
ARC actually has some interesting advantages over smart pointers. For one, there is a large amount of static analysis done at compile time that allows the system to avoid unnecessary increment/decrements of the reference counter - this can have significant performance improvements in tight inner loops, and can't be achieved using smart pointers.
Re:A Garbage Collector for C and C++ by plorkyeran on Friday July 10, 2015 @10:58AM (#9864289)
My experience has been that the awesomeness of ARC's optimizations is greatly overstated. The compiler inserts retain/release pairs around every operation that could potentially need them, and then the optimizer eliminates the redundant ones. Pretty much the only interesting nonlocal optimization it does it turn autoreleased return values into retained returns, which isn't an issue for shared_ptr to begin with.
Re:A Garbage Collector for C and C++ by pjmlp on Friday July 10, 2015 @08:36AM (#9863544)
Nothing in ANSI C++ forbids compiler vendors to make their compilers *_ptr<>() aware, but AFAIK none of them take advantage of it.