home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / c / 3299 < prev    next >
Encoding:
Internet Message Format  |  1992-12-31  |  2.3 KB

  1. Xref: sparky comp.std.c:3299 comp.lang.c:19064
  2. Newsgroups: comp.std.c,comp.lang.c
  3. Path: sparky!uunet!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!dbased.nuo.dec.com!e2big.mko.dec.com!jrdzzz.jrd.dec.com!jit533.jit.dec.com!diamond
  4. From: diamond@jit533.jit.dec.com (Norman Diamond)
  5. Subject: Re: uninitialized++;
  6. Message-ID: <C03u97.C35@jrd.dec.com>
  7. Sender: usenet@jrd.dec.com (USENET News System)
  8. Nntp-Posting-Host: jit533.jit.dec.com
  9. Reply-To: diamond@jit.dec.com (Norman Diamond)
  10. Organization: Digital Equipment Corporation Japan , Tokyo
  11. References: <HBF.92Dec29211517@gandalf.uio.no> <9236508.13290@mulga.cs.mu.OZ.AU> <C02DDv.2Kw@jrd.dec.com> <1992Dec30.172142.22789@taumet.com>
  12. Date: Thu, 31 Dec 1992 03:41:31 GMT
  13. Lines: 28
  14.  
  15. In article <1992Dec30.172142.22789@taumet.com> mike@taumet.com (Mike Ball) writes:
  16. >diamond@jit533.jit.dec.com (Norman Diamond) writes:
  17. >>In article <9236508.13290@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  18. >>>hbf@gandalf.uio.no (Hallvard B Furuseth) writes:
  19. >>>>Can this fail  - on some machine?  - in ANSI?
  20. >>  main () { int uninitialized; uninitialized += 0; return 0; }
  21. >>I think this one is not allowed to fail.
  22.  
  23. >To quote from the standard., section 1.6
  24. >"Undefined behavior - behavior, upon use of a nonportable or erroneous
  25. >program construct, or erroneous data, or of indeterminately valued objects,
  26. >for which the standard imposes no requirements."
  27. >And 3.5.7
  28. >"If an object that has automatic storage duration is not initialized
  29. >explicitly, its value is indeterminate."
  30. >Sounds like any use of the value, even adding 0, is undefined.
  31.  
  32. I would be happy to agree, but still am not quite convinced.  Is it true
  33. that the standard imposes no requirements in this case?  Examples have been
  34. posted for other problems in the past, where the values of variables were
  35. indeterminate, but the standard still imposed some requirements; the values
  36. had to be within some known set of possibilities.  Does an uninitialized
  37. int variable also have to have a value within some known set of possibilities,
  38. i.e. in the range INT_MIN to INT_MAX?  I believe the standard is unclear.
  39. --
  40. Norman Diamond                diamond@jit.dec.com
  41. If this were the company's opinion, I wouldn't be allowed to post it.
  42. Pardon me?  Or do I have to commit a crime first?
  43.