On Sat, Nov 25, 2000 at 11:55:11PM +0000, Tim Waugh wrote:> On Sat, Nov 25, 2000 at 10:53:00PM +0000, James A Sutherland wrote:> > Which is silly. The variable is explicitly defined to be zero> > anyway, whether you put this in your code or not.> > Why doesn't the compiler just leave out explicit zeros from the> 'initial data' segment then? Seems like it ought to be tought to..

Because sometimes it matters. For example, in kernel mode (and certainly forembedded programs that I'm more familiar with), the kernel does go through andzero out the so called BSS segment, so that normally uninitialized staticvariables will follow the rules as laid out under the C standards (both C89 andC99). I can imagine however, that the code that is executed before the BSSarea is zeroed out needs to be extra careful in terms of statics that itreferences, and those must be hand initialized.