News for hackers. Stuff that matters.
Re:Garbage Collection is Wrong by to3m on Thursday February 27, 2014 @04:46PM (#7315350)
You can get surprisingly far without using new or delete. std::vector, std::list and std::string are good replacements for many uses, you can of course create objects on the stack, and if your objects are stateless then they can maybe be const globals - and that can often save you a big pile of bother.

Though while new and delete are best avoided where possible, it's hardly the end of the world if you do use them. And my experience has always been that you're better off just using them, if the alternative is heavy use of smart pointers.

As member variables, smart pointers are tolerable, if copied to an ordinary pointer before heavy use; as locals or parameters, they're almost always best avoided. Over the years I've have had far more annoyance from painful single stepping, spitefully poor unoptimised performance and inconvenient watch window behaviour than I have ever had from just picking out all the memory leaks after the fact. (Which, if the code is written relatively tastefully, is usually pretty straightforward. And unless your colleagues are actively being dicks, I've always found there aren't too many to get rid of anyway.)

Re:Garbage Collection is Wrong by letzjuc on Thursday February 27, 2014 @05:29PM (#7315697)
Why use new/delete when you have make_shared and make_unique?

Like 99.99999999% of the time you can use those. Like the only situation where I think they might be not enough is for some weird uses of placement new.