Re:Applying the Linus Torvalds “Good Taste” Coding Requirement
by akkartik on Wednesday October 26, 2016 @02:14PM
(#12798948)
See my comments regarding blindly removing "duplication" at https://news.ycombinator.com/item?id=12798796 (point 4)
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement
by alkoumpa on Wednesday October 26, 2016 @02:31PM
(#12799120)
Not only is it duplicate, it also contains nasty "behavior". If prev->next equals NULL then dereferencing this would result in segfault, so in this case another if statement is required.
This line:
is another form of this line: Both delete by setting "->next". Code duplication is a common source of bugs, and that's the rationale behind Linus's version, which eliminates duped code.