Optimizations and undefined behavior
Posted Jul 21, 2009 20:04 UTC (Tue) by
BrucePerens (guest, #2510)
In reply to:
Optimizations and undefined behavior by martinfick
Parent article:
Fun with NULL pointers, part 1
"Implementation dependent" means that the folks who change the compiler, the C library, the kernel, and any stack-smashing detection/prevention code that you are using have the right to change the behavior at any time without documenting the particular side-effect that your code is depending upon.
Especially in the context of the various stack-smashing prevention hacks going around, you have no reason to believe that an uninitialized variable would not actually be initialized to a fixed value.
Undefined stuff is not a service that you can count on. Ever.
(
Log in to post comments)