News for hackers. Stuff that matters.
Re:Five Popular Myths about C++: Postscript by diarg on Tuesday December 30, 2014 @02:51PM (#8816347)
Manual memory in C++ is so cumbersome that is efectively imposible to develop programs with no memory leak bugs in real life.

Anyway, the more important fact about C++ is that it is a language complicated to no end, with an insanely bad design on purpose, so a couple of guys can sell consulting services, write books, and the like.

The year 2015 is about to come, let's just stop filling the world with such primitive and ugly ugly code. We have saner alternatives to C++ since ever.

Re:Five Popular Myths about C++: Postscript by dragontamer on Tuesday December 30, 2014 @02:54PM (#8816359)
shared_ptr<int> a = make_shared<int>(10);

What's so hard about managing that? shared_ptr is basically equivalent to Python garbage collection.

Shared_ptr were standardized in 2003, and Microsoft implemented CComPtr<> way back in the 90s for this easy to use reference-counted smart-pointer concept.

http://msdn.microsoft.com/en-us/library/aa266806%28v=vs.60%2...

So... yeah. Stop doing manual memory management in C++. Something better has existed... since the 90s.

So how about you criticize something in C++ that wasn't solved at least 16 years ago?

Re:Five Popular Myths about C++: Postscript by StephanTLavavej on Tuesday December 30, 2014 @03:52PM (#8816675)
Correction: shared_ptr wasn't in C++98/03. It was originally developed in Boost, then added to TR1 (in 2005), and finally incorporated into C++11.

One of the major differences between shared_ptr and CComPtr is that shared_ptr is non-intrusive - it can manage anything, even things like ints that don't know anything about strong/weak refcounts.

Re:Five Popular Myths about C++: Postscript by dragontamer on Tuesday December 30, 2014 @06:21PM (#8817330)
My history was off, thanks for the clarification.

Nonetheless, the concepts revolving around CComPtr and all that good stuff can be easily seen in C++98 / STL. STL Strings for instance automatically clean themselves up under the principles of RAII.

Auto_ptr<>, the first smart pointer, also was standardized in C++98. While crude and primitive by today's standards (especially compared to unique_ptr<>'s explicit RValue semantics), auto_ptr<> shows me that even in the mid 90s, people understood the principles of RAII.

At least, if you were a learned C++ programmer.