home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / c / 3254 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.1 KB  |  42 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!zaphod.mps.ohio-state.edu!usc!sdd.hp.com!decwrl!deccrl!news.crl.dec.com!rdg.dec.com!uvo.dec.com!e2big.mko.dec.com!jrdzzz.jrd.dec.com!jit533.jit.dec.com!diamond
  3. From: diamond@jit533.jit.dec.com (Norman Diamond)
  4. Subject: Re: Compatability of enum types and integer types
  5. Message-ID: <Bzn05H.nq@jrd.dec.com>
  6. Sender: usenet@jrd.dec.com (USENET News System)
  7. Nntp-Posting-Host: jit533.jit.dec.com
  8. Reply-To: diamond@jit.dec.com (Norman Diamond)
  9. Organization: Digital Equipment Corporation Japan , Tokyo
  10. References: <1992Dec21.225604.18749@netcom.com>
  11. Date: Tue, 22 Dec 1992 01:29:40 GMT
  12. Lines: 28
  13.  
  14. In article <1992Dec21.225604.18749@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:
  15. >The ANSI C standard says (in 3.5.2.2):
  16. >    "Each enumerated type shall be compatible with an integer type;
  17. >    the choice of type is implementation-defined."
  18. >I interpret it to mean that there *must* exist some integer type `T' such that
  19. >        enum E { red, green, blue } object;
  20. >        enum E object;
  21. >        T object;
  22. >... is a valid translation unit.
  23. >The person on the other side of this discussion seems to be claiming that
  24. >[...] the implementation may "put the fix in" so that no matter what type
  25. >you try to use for `T', the implementation will say "Sorry.  You guessed wrong
  26.  
  27. Being implementation-defined means that it must be documented.  Regarding
  28. some other implementation-defined matters (e.g. which of two possible results
  29. is obtained from the % operator) most of the regulars in this newsgroup seem
  30. to feel that the implementation must define a result that is identical over
  31. all usages.  This kind of opinion suggests that the documentation must tell
  32. you which type you can use for `T'.
  33.  
  34. My opinion is that the documentation can tell you that the implementation
  35. plays dirty pool.  However, I seem to be a minority of 1.
  36.  
  37. Surely an interpretation ruling would carry more weight than any of the above.
  38. --
  39. Norman Diamond       diamond@jit081.enet.dec.com
  40. If this were the company's opinion, I wouldn't be allowed to post it.
  41. "It's been a lovely recession."
  42.