Null pointers, one month later
Null pointers, one month later
Posted Aug 23, 2009 8:23 UTC (Sun) by oak (guest, #2786)Parent article: Null pointers, one month later
by the compiler in every declaration which does not include an explicit
initialization for that pointer."
Only (structure or other) variables that are static (global or static in
the local scope) are guaranteed by C to be initialized to zero. Compiler
does this by storing them into BSS which is zeroed by the OS on process
startup.
Other variables *may* be zero if their storage happens to be in a part of
heap or stack that hasn't been used earlier by the process. And even this
happens only on OSes that initialize the new pages to zero. Otherwise the
variables contain a "random" value.
