This is not good code, it requires too much thought to realise what its doing.
This is not good code, it requires too much thought to realise what its doing.
That said, for someone unused to the syntax (as I am!), I agree that it is definitely harder to mentally parse. So which is objectively better probably depends on your audience.
I guess when your audience is kernel developers, this isn't that much of a problem...
I've got 20 years experience developing this kind of stuff and to me, its not as simple as it could be, therefore it could be better.
(It's at least 23 years old because I learned from textbooks that have this example code way back then. It probably dates all the way back to K&R.)
The point isn't "can I understand it"...
the point is "Would someone who hadn't seen it before have to do another mental operation to understand it?"
...and yes... dereferencing is another operation you have to do in your head to understand it.
Multi-level pointer dereferencing is a fundamental C / assembly language skill and Linus' example was just about the most basic example there is.