[lkml]   [2000]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] removal of "static foo = 0"
    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 for
    embedded programs that I'm more familiar with), the kernel does go through and
    zero out the so called BSS segment, so that normally uninitialized static
    variables will follow the rules as laid out under the C standards (both C89 and
    C99). I can imagine however, that the code that is executed before the BSS
    area is zeroed out needs to be extra careful in terms of statics that it
    references, and those must be hand initialized.

    Michael Meissner, Red Hat, Inc.
    PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
    Work: phone: +1 978-486-9304
    Non-work: fax: +1 978-692-4482
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 12:47    [W:0.021 / U:1.312 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site