News for hackers. Stuff that matters.
Re:Re: [mongrel2] C versus C++ (2010) by pmelendez on Saturday December 28, 2013 @01:30PM (#6975682)
>" You have to do all the same memory checks, use valgrind, make sure you've got destructors, and then that's made more complex by templates, object lifecycles, exception rules, etc.. Frankly C++ doesn't have better memory management than C, it just has more complex management."

I strongly disagree with the author, and I suspect he is biased for the "old school" C++ (as he called it). For instance:

>make sure you've got destructors.

Objects allocated on the stack are guaranteed to be destroyed and hence their destructors to be called. Which is very convenient if those objects are owners of a resource (like a DB connection).

>"and then that's made more complex by templates, object lifecycles, exception rules, etc.."

Object lifecycle are well defined but if all is an OOP problem not a C++ one.

As for the rest, the beauty of C++ is that if there is something that doesn't apply to your project, then you don't use it. Your are not required to use exceptions or templates if you don't want to.

> "Frankly C++ doesn't have better memory management than C, it just has more complex management"

Again, if you want to it can be complex, or it can be the same management you would do in C. That's a flexibility that simply you don't have in C.

Re:Re: [mongrel2] C versus C++ (2010) by dkirkman on Saturday December 28, 2013 @02:03PM (#6975852)
> Your are not required to use exceptions or templates if you don't want to.

This is absolutely true -- at least if you're working alone. But I've always found the whole "let's use a subset of c++" to be untenable on long projects. Somebody always joins that's infatuated with Alexandrescu, or some random error handling strategy, and then you end up in endless debates about concepts vs. abstract base classes. Those debates can be fun, but they seem to too often leave behind hurt feelings and demoralized team members.

If you just throw back to c, all you have to deal with is the argument that "we should really use c++, because <insert some random thing>". Those don't last too long, you just have to respond that it's a c project :)

Re:Re: [mongrel2] C versus C++ (2010) by catnaroek on Saturday December 28, 2013 @02:10PM (#6975894)
> endless debates about concepts vs. abstract base classes

Really? Generic programming's better static error detection facilities makes it the superior alternative with respect to object-orientation, whenever you can choose between the two. This pretty much settles the question IMO.

Re:Re: [mongrel2] C versus C++ (2010) by eropple on Saturday December 28, 2013 @01:39PM (#6975715)
Agreed. His Boost complaints are odd, too; even in 2010 it certainly didn't take "forever" to build Boost and its templates are for the most part very logical and essentially hidden to you (see for example boost::format, which does pretty much exactly what he says he wants out of a formatter).

He's got a point that for mongrel2 the full feature set of C++ doesn't necessarily make sense, but having it available when I want it is really valuable to me. For my game, I literally couldn't do what I'm doing without some really big, really gross crap that would be multiple times the code I have. (Faking polymorphism with state machines makes everyone sad.)

Re:Re: [mongrel2] C versus C++ (2010) by pmelendez on Saturday December 28, 2013 @01:49PM (#6975760)
>"the full feature set of C++ doesn't necessarily make sense, but having it available when I want it is really valuable to me"

Exactly my point. In C++ you have all those tools available and you won't pay for them until you start using them.