Re:Applying the Linus Torvalds “Good Taste” Coding Requirement
by troydj on Wednesday October 26, 2016 @09:28AM
(#12796256)
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).
[ Parent
| on HN ]
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement
by k__ on Wednesday October 26, 2016 @10:14AM
(#12796580)
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.