C++ traps that D2 doesn't avoid yet?

ore-sama spam at here.lot
Thu Nov 6 10:40:16 PST 2008


bearophile Wrote:

> This page lists a lot of C++ traps and pitfalls in a short space. I assume D has to avoid or render meaningless a quite high percentage of them.
> The nice thing of that list is that I think most (maybe 80-90%) of those traps and pitfalls (and several others that aren't listed, like allowing simple syntactical mistakes like putting a & where a && was requires or vice versa, etc) can be avoided by a language like D
> but seeing the huge troubles C++ has gone to be as much compatible as possible with C I'd say that keeping the original C semantics when it is known to cause troubles is _always_ bad. In such situations I prefer a language that acts correctly

Most of these pitfalls are actually features, not bugs and are used massively. Like implicit casts, & instead of &&, assignment instead of comparison etc. These are pitfalls for novice programmers. Why bother? Everything is a pitfall for a novice programmer. You can safely say that every feature is a pitfall because programmer can make mistake in any place. I saw a man writing a program randomly typing something on the keyboard :) And he's not alone. What will be a pitfall for such programmers?

ps why there was a need to reinvent identity operator, I wonder? It already was in JavaScript.



More information about the Digitalmars-d mailing list