D vs C++

bearophile bearophileHUGS at lycos.com
Sat Dec 25 23:40:09 PST 2010


Don:

>Why are break and continue bad?<

Using fuzzy logic they are "25% bad" :-)
There is an interesting discussion on the C2 wiki, they mostly agree with you:
http://c2.com/cgi/wiki?InternalLoopExitsAreOk


>I haven't heard anyone make that claim for a very long time.<

If 50 years from now people will use the ZZ language that (like D) is essentially C plus some other things, then advices about the C-class languagages from 1980 will be mostly good still.


>BTW everyone I've known who thought they were evil, also wanted to ban multiple return statements in a single function.<

Multiple return statements are OK iff the function/method is not too much long (or complex). There are less common situations where even in long functions multiple returns are an improvement.


>Most of them didn't like case statements, either.<

They are good, if fall through is not the default and if there is some built-in way to make sure you have considered all cases.

Bye,
bearophile


More information about the Digitalmars-d mailing list