LWN.net Logo

Removing uninitialized_var()

Removing uninitialized_var()

Posted Dec 21, 2012 21:22 UTC (Fri) by hummassa (subscriber, #307)
In reply to: Removing uninitialized_var() by giraffedata
Parent article: Removing uninitialized_var()

My point is that, as easy as it is to confuse gcc or clang, confusong the programmer who has to read the code after you is even easier! Let is substitute your question #2 for "did you ever have had eclampsia?" And now the comparison is fair. 50 percent of male respondents will not know what it is and many will answer wrongly.


(Log in to post comments)

Removing uninitialized_var()

Posted Dec 21, 2012 23:13 UTC (Fri) by apoelstra (subscriber, #75205) [Link]

> My point is that, as easy as it is to confuse gcc or clang, confusong the programmer who has to read the code after you is even easier!

This is not always true. For a small-enough function (or small-enough block), a programmer can probably build a mental parse tree just as well as the compiler can -- and then, because he is a human gifted with all manner of high-level knowledge and context, he can easily see things that the compiler might miss.

And in my experience, "small enough" includes many non-trivial functions of 5-10 lines. Also in my experience, these are the sorts of functions that trigger uninitialized variable warnings.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds