Pattern: Fall-through in switch
statement
Issue: -
Fall-through in switch statements is often unintentional and a bug.
For example, the following is not allowed:
switch(foo) {
case 1:
someFunc(foo);
case 2:
someOtherFunc(foo);
}
However, fall through is allowed when case statements are consecutive or a magic /* falls through */
comment is present. The following is valid:
switch(foo) {
case 1:
someFunc(foo);
/* falls through */
case 2:
case 3:
someOtherFunc(foo);
}