|
|
Subscribe / Log in / New account

An end to implicit fall-throughs in the kernel

An end to implicit fall-throughs in the kernel

Posted Aug 2, 2019 10:11 UTC (Fri) by dgm (subscriber, #49227)
Parent article: An end to implicit fall-throughs in the kernel

In my experience,

/* fall through */

is OK, but

/* no break */

is superior (from the perspective of a non-native English speaker).


to post comments

An end to implicit fall-throughs in the kernel

Posted Aug 2, 2019 13:04 UTC (Fri) by Freeaqingme (guest, #103259) [Link]

Nonnative speaker reporting in as well. I think programming syntax doesn't have to be 1:1 good English. The brain uses separate 'linguistic registers' for programming languages. So even though a programming language uses primarily English terms, the brain will typically regard them as their own language (or dialect, so you wish) when looking at some code.

So for all intents and purposes they could call it 'foobar', and you'd simply learn what 'foobar' means in this context. Furthermore, I think it's a good practice to actually describe the behavior by what it does, not by what it doesn't do.

As a fun anecdote, the PHP language for a very long time had a T_PAAMAYIM_NEKUDOTAYIM token ('::'). Even though PHP uses primarily English terms, it was written by two Israeli men, who felt it was nice to put something of their own culture/heritage in the language. Undoubtedly it's a bit weird for an English programmer to get an error message 'unexpected T_PAAMAYIM_NEKUDOTAYIM', but after you Google it the first time you simply remember that you probably put some '::' somewhere where the interpreter did not expect it.

An end to implicit fall-throughs in the kernel

Posted Aug 2, 2019 21:35 UTC (Fri) by edeloget (subscriber, #88392) [Link] (1 responses)

/* fall through */ tells what the code is expected to do (i.e. it documents the intention), while /*no break */ is just telling how it's written. The latter could have been added by someone who was surprised that there were no break, and might be a hasitly and lazily written question :)

An end to implicit fall-throughs in the kernel

Posted Aug 5, 2019 10:19 UTC (Mon) by dgm (subscriber, #49227) [Link]

My intention is always to write code that does not break. Sincerely, I hate code that falls throught.

;-P


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds