User: Password:
|
|
Subscribe / Log in / New account

Fun with NULL pointers, part 1

Fun with NULL pointers, part 1

Posted Jul 21, 2009 11:48 UTC (Tue) by dunlapg (subscriber, #57764)
Parent article: Fun with NULL pointers, part 1

Who on earth implemented the gcc "optimization"? Check-for-null-after-use is almost always a bug, isn't it? It should be throwing a warning out, not optimizing the null check away.


(Log in to post comments)

Fun with NULL pointers, part 1

Posted Jul 21, 2009 12:01 UTC (Tue) by johill (subscriber, #25196) [Link]

I'd think very often it's not. Imagine the NULL pointer check was inserted by a macro or an inlined function, into a function that's known to be called with a non-NULL argument, say because that argument is on the stack.


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