home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!world!ksr!zdenek
- From: zdenek@ksr.com (Zdenek Radouch)
- Newsgroups: comp.os.linux
- Subject: Re: IMPORTANT [BUG in 0.99] Re: [ANNOUNCE]: linux version 0.99
- Message-ID: <20502@ksr.com>
- Date: 29 Dec 92 15:33:58 EST
- References: <1992Dec19.222324.22106@klaava.Helsinki.FI> <1hpsasINN6e@meaddata.meaddata.com>
- Sender: news@ksr.com
- Organization: Kendall Square Research Corp.
- Lines: 49
-
- Stephen Williams writes:
-
- >Statics are either explicitly initialized or they are not.
- >If they are not, their contents are UNDEFINED until set.
- >This is per ANSI C.
- >There is NO requirement of the compiler or system to zero
- >un-initialized statics (or auto's).
-
-
- I'll quote for you:
-
- "A static object not explicitly initialized is initialized as if it
- (or its members) were assigned the constant 0. The initial value of
- an automatic object not explicitly initialized is undefined."
-
-
- >The fact that some systems waste time doing so is no reason rely on it
- >as a feature. This was already debated and tossed out as something to
- >rely on.
-
- Where ???
-
- >If you wanted to clear the bss segment, as an explicit optimization
- >over having nulls in your executable, link a dummy module first (ok,
- >after crt0.o) and last that each have a dummy bss variable.
-
- So that you get screwed up only in your crt0!
- To quote again: "The initialization is done once only, conceptually before
- the program starts executing..."
- All systems I have used would do this in the loader.
-
- >And, yes, it would be nice if the nulling were garunteed.
-
- It is guaranteed!
-
- >The problem
- >I think is the overhead incurred for a program that has a huge bss and
- >doesn't need it initialized. A better solution would be (if it
- >weren't for the headache..) to have bss and bsz segments.
-
- That's bullshit, in the 10+ years I have been developing unix I've
- never encountered environment that would omit the BSS initialization,
- even as an optimization, because of the trouble this would be causing.
-
- -Z
-
- P.S.
- You could argue that initializing explicitly might be a good PRACTICE,
- but it certainly is not (and never was) required by the language definitions.
-