4 ms·
Absolutely. Further, I would consider Linus's one-liner 'indirect=...' to be 'clever' code. If I were reviewing it, I would want it expanded into more obvious
by TickleSteve 10y ago
Absolutely.
Further, I would consider Linus's one-liner 'indirect=...' to be 'clever' code.
If I were reviewing it, I would want it expanded into more obvious code as it requires too much cognitive overhead to parse.
- sverrirs 10y agoAgree on the cognitive overhead. People will and are arguing that "it is kernel code, it should be complicated" but I really think this is backwards. Because it is low level and debugging is really cognitively intense and difficult at this level the code should be even clearer and easier to understand.
- addicted 10y agoPeople aren't arguing kernel code must be complicated. People are arguing that dealing with pointers should be second nature to kernel developers, so the lines of code causing you and me congnitive overhead should be second nature to a kernel Dev.
- TickleSteve 10y agoI'm an embedded/real-time/bare-metal softie with over 20 years experience.... I do this stuff all day, every day. This code is inherently too complex. it should be simplified
- MawKKe 10y agoComparing the two versions, I found the 'clever' version to have less cognitive overhead, since the reader has less state to keep track of (1 vs 2 variables). I don't find the pointer syntax that difficult to reason with. How would you expand the code?