Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!think!husc6!cmcl2!rutgers!mtune!codas!novavax!murphy!dave From: dave@murphy.UUCP Newsgroups: comp.lang.c Subject: Re: Query: Implementation with non-zero NULL Message-ID: <374@murphy.UUCP> Date: Wed, 3-Jun-87 16:25:41 EDT Article-I.D.: murphy.374 Posted: Wed Jun 3 16:25:41 1987 Date-Received: Sat, 6-Jun-87 04:29:45 EDT References: <1217@batcomputer.tn.cornell.edu> Organization: Gould CSD, Fort Lauderdale, FL Lines: 26 Summary: statics ARE supposed to be zeroed In article <1217@batcomputer.tn.cornell.edu>, garry@batcomputer.tn.cornell.edu (Garry Wiegand) writes: > You should NEVER assume a not-explicitly-initialized static variable > is given any particular value by anybody. K&R says, on p. 198, about halfway down: "Static and external variables which are not initialized are guaranteed to start off as 0." The ANSI draft that I have (admittedly an old one, July 1985) says, in section C.5.6, p.51: "If such an object [static object] is not initialized explicitly, it is initialized implicitly as if every scalar member were assigned the integer constant 0." In most virtual-memory environments, this is done by the OS zeroing out the allocated memory for security reasons. The only place where it might cause problems is in zeroing out static pointers or floating types, where the bit pattern that means zero might not be the all-zeroes pattern. --- "Country beats the hell out of me" -- Jerry Dale McFadden Dave Cornutt, Gould Computer Systems, Ft. Lauderdale, FL [Ignore header, mail to these addresses] UUCP: ...!{sun,pur-ee,brl-bmd,seismo,bcopen,rb-dc1}!gould!dcornutt or ...!{ucf-cs,allegra,codas,hcx1}!novavax!gould!dcornutt ARPA: dcornutt@gswd-vms.arpa "The opinions expressed herein are not necessarily those of my employer, not necessarily mine, and probably not necessary."