home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / linux / 22065 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.1 KB

  1. Path: sparky!uunet!world!ksr!zdenek
  2. From: zdenek@ksr.com (Zdenek Radouch)
  3. Newsgroups: comp.os.linux
  4. Subject: Re: IMPORTANT [BUG in 0.99] Re: [ANNOUNCE]: linux version 0.99
  5. Message-ID: <20502@ksr.com>
  6. Date: 29 Dec 92 15:33:58 EST
  7. References: <1992Dec19.222324.22106@klaava.Helsinki.FI> <1hpsasINN6e@meaddata.meaddata.com>
  8. Sender: news@ksr.com
  9. Organization: Kendall Square Research Corp.
  10. Lines: 49
  11.  
  12. Stephen Williams writes:
  13.  
  14. >Statics are either explicitly initialized or they are not.
  15. >If they are not, their contents are UNDEFINED until set.
  16. >This is per ANSI C.
  17. >There is NO requirement of the compiler or system to zero
  18. >un-initialized statics (or auto's).
  19.  
  20.  
  21. I'll quote for you:
  22.  
  23. "A static object not explicitly initialized is initialized as if it 
  24. (or its members) were assigned the constant 0. The initial value of
  25. an automatic object not explicitly initialized is undefined."
  26.  
  27.  
  28. >The fact that some systems waste time doing so is no reason rely on it
  29. >as a feature.  This was already debated and tossed out as something to
  30. >rely on.
  31.  
  32. Where ???
  33.  
  34. >If you wanted to clear the bss segment, as an explicit optimization
  35. >over having nulls in your executable, link a dummy module first (ok,
  36. >after crt0.o) and last that each have a dummy bss variable.
  37.  
  38. So that you get screwed up only in your crt0!
  39. To quote again: "The initialization is done once only, conceptually before
  40. the program starts executing..."
  41. All systems I have used would do this in the loader.
  42.  
  43. >And, yes, it would be nice if the nulling were garunteed.
  44.  
  45. It is guaranteed!
  46.  
  47. >The problem
  48. >I think is the overhead incurred for a program that has a huge bss and
  49. >doesn't need it initialized.  A better solution would be (if it
  50. >weren't for the headache..) to have bss and bsz segments.
  51.  
  52. That's bullshit, in the 10+ years I have been developing unix I've
  53. never encountered environment that would omit the BSS initialization,
  54. even as an optimization, because of the trouble this would be causing.
  55.  
  56. -Z
  57.  
  58. P.S.
  59. You could argue that initializing explicitly might be a good PRACTICE,
  60. but it certainly is not (and never was) required by the language definitions.
  61.