Uninitialized global data (was Re: Global variables)

Karl Heuer karl at haddock.ISC.COM
Wed Feb 17 15:21:19 AEST 1988


In article <1744 at phoenix.Princeton.EDU> rjchen at 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 at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list