Path: utzoo!utgpu!water!watmath!clyde!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Uninitialized global data (was Re: Global variables) Message-ID: <2597@haddock.ISC.COM> Date: 17 Feb 88 05:21:19 GMT References: <1744@phoenix.Princeton.EDU> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 23 In article <1744@phoenix.Princeton.EDU> rjchen@phoenix.Princeton.EDU (Raymond Chen) writes: >I believe that global data initialized to zero go into [the bss segment]. >... When the program is loaded, the loader allocates the requisite amount of >space and initializes it to zero at runtime. Close enough. But this is a property of one particular implementation, not a description of C in general. Note also that if a floating-point zero or a null pointer has some representation other than all-bits-zero, then any floating or pointer object with static duration and no explicit initializer would not be correctly handled by this gimmick. (Unless you have a really smart loader.) The compiler is obliged to initialize it to a zero of the appropriate type, which can (of course) be placed in the data segment along with the explicitly initialized variables. >What [bss] stands for is beyond me. Oh no. Followups on this subtopic, please redirect to comp.misc and put "bss" in the subject line so I can kill it. I hope this doesn't get as bad as the "foo" postings a while back. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint