Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Uninitialized externals and statics.
Message-ID: <1989Aug17.162206.21724@utzoo.uucp>
Organization: U of Toronto Zoology
References: <2128@infmx.UUCP>
Date: Thu, 17 Aug 89 16:22:06 GMT

In article <2128@infmx.UUCP> dror@infmx.UUCP (Dror Matalon) writes:
>	K&R 2.4 say "External and static variables are initialized 
>to zero by default, but it is good style to state the initialization
>anyway."
>
>	Is this really portable ? I always initialize globals but I want
>to know if I need to change some old stuff that counts on uninitialized
>variables being initialized to zero.

The initialization to zero for external and static variables is a property
of the C language; all definitions of the language agree on this.  Any
compiler that does not implement it is broken.

Note that automatic variables (i.e., essentially all variables defined
within a function) do *not* get initialized to anything in particular.
-- 
V7 /bin/mail source: 554 lines.|     Henry Spencer at U of Toronto Zoology
1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu