From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) Subject: Re: IMPORTANT [BUG in 0.99] Re: [ANNOUNCE]: linux version 0.99 Date: 29 Dec 1992 20:14:49 GMT
sdw@meaddata.com (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).
Chapter and verse, friend, chapter and verse. I want you to give the
chapter and verse in the ANSI or the ISO C standard (they are the
same, except that their chapters and verses are numbered differently)
that says that statics are not initialized to zero unless explicitly
initialized to something else. (I agree about the part about auto's,
though.)
I don't have the standard (I'm way too poor to afford it), but K&R 1
says, on page 199, in A8.6, Initialization,
Static and external variables which are not initilized are
guaranteed to start off as 0; automatic and register variables
which are not initialized are guranteed to start off as
garbage.
K&R 2 says, on page 219, A8.7, Initialization,
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.
I need more convincing than your word. Chapter and verse (plus
quotations as suitable) is enough.
>The fact that some systems waste time doing so is no reason rely on it
>as a feature. This was already debated and tossed out as something to
>rely on.
It has been a feature of C since the early 1970's (according to my
knowledge it was there way before K&R 1 was published in 1978).