| Recent GCC can diagnose the situation where a switch case falls through without a /* fallthrough */ comment.[1] C++17 has a comment-like language feature for demarcating desired fallthrough. Fallthrough in case processing is often useful; it's just not such a great default. In the TXR Lisp tree-case[2] construct, any case which
returns the : object falls through to the next case. This is used all over the place in the library. -- [2] https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/Warning-Options... [1] https://www.nongnu.org/txr/txr-manpage.html#N-03D834A5 |
This is a tangent, but it reminds me of a personal policy of mine: if I'm thinking about changing a default, I ask myself if there should be a default at all.
The consequences of having the wrong default were serious enough that it even came to my attention. So by changing the default, am I potentially exchanging one set of problems for another?
Sometimes it would be better overall if the user is forced to explicitly state which way they want it. Not always, of course, but I like to ask the question.