3 ms·
Conditionals are so simple it’s basically the first thing anyone learns. Anyone can understand the first approach. The latter requires knowledge that is specifi
by ewindal 6y ago
Conditionals are so simple it’s basically the first thing anyone learns. Anyone can understand the first approach. The latter requires knowledge that is specific to lower level languages,concepts that are certainly not taught universally.
The latter approach is definitely not the easiest to understand. It is, however, what Linus considers «good taste in coding.»
- nickelpro 6y agoIf you're coding in Linus's world you're going to understand indirection, the example is excellent given the context
- coldtea 6y ago>Conditionals are so simple it’s basically the first thing anyone learns. That's neither here, nor there though. The simplicity of a concept does not directly translate to how hard it makes the code (assembly is simpler in the sense of having fewer and simpler constructs than e.g. Python but much much harder to code in). Conditionals, and the exponential increase in state space they bring, are still one of the biggest source of errors and complexity in code.
- eloff 6y agoYes, excellently put. That's exactly why Linus' code is easier to understand. The extra control flow operations really increases the time to understand if the code is correct and likewise introduces many opportunities for error.