LWN.net Logo

Removing uninitialized_var()

Removing uninitialized_var()

Posted Dec 21, 2012 5:29 UTC (Fri) by nevets (subscriber, #11875)
In reply to: Removing uninitialized_var() by clugstj
Parent article: Removing uninitialized_var()

No, NULL may be better than uninitialized_var(), but it is not better than hiding gcc from warning about it.

Yes, a NULL pointer is easy to debug after a crash, but if it requires a tight race to get to a point where NULL will crash, that means you wont detect the bug until the crash happens. If that crash happens while on a production system, it's still a major issue.

My point is that uninitialized_var() isn't very good because it may hide bugs, but so is blindly initializing something, even with NULL. It's still hiding a bug.


(Log in to post comments)

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