On Tue, 22 Jun 2010 09:17:57 -0400, Adam Ruppe <destructiona...@gmail.com> wrote: > > What you guys are saying makes enough sense. switch will always be a > series of labels and jumps in my mind, but I can deal with this. > > One note that I think is the main reason people find fallthrough > confusing: they hit tab once too many times. > > switch(a) { > case 10: > case 20: // obvious fallthrough, no break directly above it > break; // obvious break - same indentation as the case, just like > braces would be > case 30: > } > > I notice a lot of other people indent the break further than the case, > which is something I only do if the break is not the last statement > (which means it is probably indented twice, being inside an if or > something.) > > > Oh well.
I would argue the exact opposite. I think it's not immediately clear what's associated with each case label in the example given. It's a matter of personal preference, though, in the end. I leave labels (both for switches and goto) at the left-most position of their enclosing block: switch (a) { case 5: case 10: break; default: ; } void main () { goto doSomething; doSomething: writeln("foobar"); } But I know there will probably be lots of people who dislike that as well. :P