No more fall through in case statement?

Bill Baxter dnewsgroup at billbaxter.com
Mon Jan 7 16:21:18 PST 2008


S. wrote:

> However, a simple step-through will reveal a case falling through when it shouldn't.

Eliminating the possibility of unintentional fall-through altogether 
will eliminate the need for even your "simple step-through".

And simple step through may not be so simple when the program is 
hundreds of thousands of lines long.  Mistaken fall-through in some 
switch in some function in some module can change a state, and that 
state can later trigger another different change of state and so on, 
until finally somewhere your program crashes because of an incorrect 
state a dozen causal steps away from the original problem.

So "simple step through" may mean "simply" stepping through thousands of 
lines of code to try to figure out where things first went wrong.  It 
can be very non-trivial.

Implicit switch fall-through is evil.

--bb



More information about the Digitalmars-d mailing list