On Fri, Sep 20, 2013 at 09:14:28AM +0200, PauloPinto wrote: > On Thursday, 19 September 2013 at 23:50:04 UTC, H. S. Teoh wrote: [...] > I dislike C, and will take C++ safety and abstraction capabilities > over C, unless forced to do otherwise. [...]
C++ does have some parts that improve over C, it's true. But it's also a minefield filled with pitfalls. Due to its insistence with C compatibility, it basically can only paper over C's flaws, but push hard enough and you're floundering in C problems once more. Well, actually, don't even push -- write straightforward code, and it's almost always wrong. And of the exponential number of ways to write *non*-straightforward code, only one is correct (if that even exists in C++ -- maybe I should rather say, only one is least problematic, 'cos they all are). It's unfortunate that due to C++ basically giving you a gun that can shoot you in the foot backwards while you're aiming at something else (all convniently abstracted away behind wrappers so you won't even notice the bleeding), it's just sooo easy to abuse. As I said many times before, at my job they migrated from C++ back to C, because, for all of its flaws, C at least has a well-understood core and well-known ways of managing its risky parts. The C++ codebase we used to have was completely unmaintainable because it just combines so many C++ features in the worst possible ways -- something inevitable when it has passed through so many hands. Both C and C++ require a lot of coding by convention and extreme attention to detail, but at least in C, mistakes tend to be noticed rather quickly, whereas in C++ you could be coding for months, years, before you even notice anything wrong. And by then, it's too late to fix it because half the codebase is already written in the "wrong" way. (And there are just too many wrong ways to write C++ code.) It's such a refreshing change whenever I get to work with D in my free time. D does have its own warts and problems, it's true, but it's a world of a difference from C/C++. It's like the difference between being pricked by a needle every now and then vs. drinking glass shards. T -- Be in denial for long enough, and one day you'll deny yourself of things you wish you hadn't.
