Andrei Alexandrescu wrote:


Speaking of switch, I have tried to convince Walter to require either a break; or a goto case xxx; at the end of each snippet inside a switch. I was surprised by his answer: "but I use fall through all the time!" :o)

I personally think requiring a goto case xxx; is more robust in presence of code maintenance because its semantics is invariant to code moves.


Andrei

First of all goto case is without a doubt safer and more robust but please leave as much of D as possible to remain compatible with C.

Since D has objects a lot of code can be polymorphic through the classes/interfaces that C didn't have.

C's design is trust the programmer, provide full power. It is unsafe agreed but by design. Breaking compatibility between D1, D2 etc may be an issue but if you loose the C then you lose what defines D.

Reply via email to