Hacker News new | ask | show | jobs
by troydj 3519 days ago
Linus' "good" version has a McCabe cyclomatic complexity of 2, whereas the "bad" version has a value of 3. So, objectively, one could argue there is improvement there (albeit small). Validation of the "good" version will be easier (e.g. code coverage testing) with fewer paths through the code. Additionally, a lower cyclomatic complexity typically implies less stress on the developer's working memory while reading code (since you don't have to consume an internal brain "register" holding the result of a conditional while following the flow of control).
1 comments

I thought the same.

On the other hand it took me a bit of time to figure out what's going on.

But I'm not C dev, so that could be the issue here.

Serious question: after figuring it out, did you have a somewhat better grasp of linked list mechanics than before?
I had a better grasp of how to work with them (am not who you replied too).

I never had to build my own linked list though. I never took those basic courses.