From: mcampbel@cs.ucf.edu (Mike Campbell ) Subject: Re: IMPORTANT [BUG in 0.99] Re: [ANNOUNCE]: linux version 0.99 Date: 29 Dec 1992 21:53:59 GMT
zdenek@ksr.com (Zdenek Radouch) writes:
>Stephen Williams writes:
>>Statics are either explicitly initialized or they are not.
>>If they are not, their contents are UNDEFINED until set.
>>This is per ANSI C.
>>There is NO requirement of the compiler or system to zero
>>un-initialized statics (or auto's).
>I'll quote for you:
>"A static object not explicitly initialized is initialized as if it
>(or its members) were assigned the constant 0. The initial value of
>an automatic object not explicitly initialized is undefined."
You are correct - what would be the advantage of a static in a function?
If you NEEDED to initialize it, you would lose the value of the variable
every time the function was called, nullifying the advantage statics have
in functions, (namely holding a value out of visibility).