Hacker News new | ask | show | jobs
by TickleSteve 3522 days 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.

2 comments

Comparing 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?

Agree 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.

People 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.
I'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