Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!cit-vax!oberon!sdcrdcf!ism780c!ism780!marv From: marv@ism780.UUCP Newsgroups: comp.lang.c Subject: Re: Query: Implementation with non-zero NULL Message-ID: <724@ism780.UUCP> Date: Tue, 2-Jun-87 21:32:15 EDT Article-I.D.: ism780.724 Posted: Tue Jun 2 21:32:15 1987 Date-Received: Sat, 6-Jun-87 06:28:38 EDT References: <158@delftcc.UUCP> <1070@viper.Lynx.MN.ORG> Reply-To: marv@ISM780.UUCP (Marvin Rubenstein) Organization: Interactive Systems Corp., Santa Monica, CA Lines: 27 > If, you're refering to an initialized static, it's whatever you >specify. If, on the other hand, you're refering to an UN-initialized >static pointer, the answer is a resounding "Neither!".... An un- >initialized variable is just that. It can initialy hold literaly >-any- value that variable can possibly hold. You should never assume >anything about any variable until you've set it. >John Stanley (john@viper.UUCP) >Software Consultant - DynaSoft Systems >UUCP: ...{amdahl,ihnp4,rutgers}!{meccts,dayton}!viper!john K&R does not seem to agree with the above. On page 198 one reads: "Static and external variables which are not initialized are guaranteed to start off as 0: automatic and register variables which are not initialized are guaranteed to start of as garbage." Note that the ascii character '0' appearing in a C source program has a context dependent meaning. It can represent either the integer constant that falls between -1 and +1 or it can represent a constant pointer that points to no object. With this in mind I take the above quote to mean that all uninitalized (static or external) variables that are numbers will start out with the value zero and all uninitialized variables that are pointers start out pointing to no object. I believe this is all inclusive since the only primative types in C are pointers and numbers (with various ranges and scalings). Marv Rubinstein -- Interactive Systems