> Thou shalt initialize thy static variables, else The Machine shall set them to zero.
Isn't that last part a bad assumption since it could be arbitrary values as well? Because people expecting a default zero value might be surprised otherwise.
Isn't that last part a bad assumption since it could be arbitrary values as well? Because people expecting a default zero value might be surprised otherwise.
• if it has pointer type, it is initialized to a null pointer;
• if it has arithmetic type, it is initialized to (positive or unsigned) zero;
[end quote]
—C99 Standard, §6.7.8
EDIT: That said, it can only relied upon to be zero at the first call of the function.
I mean, they can do things that make it easier or harder, but satisfying a language spec isn't what they do (unless you want to count an ISA as a language spec, which it kind of is).