Article View: comp.std.c
Article #2901Re: Compatability of enum types and integer types
From: Norman Diamond
Date: Tue, 22 Dec 1992 01:29
Date: Tue, 22 Dec 1992 01:29
28 lines
2165 bytes
2165 bytes
In article <1992Dec21.225604.18749@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:
>The ANSI C standard says (in 3.5.2.2):
> "Each enumerated type shall be compatible with an integer type;
> the choice of type is implementation-defined."
>I interpret it to mean that there *must* exist some integer type `T' such that
> enum E { red, green, blue } object;
> enum E object;
> T object;
>... is a valid translation unit.
>The person on the other side of this discussion seems to be claiming that
>[...] the implementation may "put the fix in" so that no matter what type
>you try to use for `T', the implementation will say "Sorry. You guessed wrong
Being implementation-defined means that it must be documented. Regarding
some other implementation-defined matters (e.g. which of two possible results
is obtained from the % operator) most of the regulars in this newsgroup seem
to feel that the implementation must define a result that is identical over
all usages. This kind of opinion suggests that the documentation must tell
you which type you can use for `T'.
My opinion is that the documentation can tell you that the implementation
plays dirty pool. However, I seem to be a minority of 1.
Surely an interpretation ruling would carry more weight than any of the above.
--
Norman Diamond diamond@jit081.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
"It's been a lovely recession."
Technical Details
Message-ID:
<Bzn05H.nq@jrd.dec.com>Path:
arc1-ca.pugleaf.net!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!diamondReferences:
<1992Dec21.225604.18749@netcom.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!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 From: diamond@jit533.jit.dec.com (Norman Diamond) Subject: Re: Compatability of enum types and integer types Message-ID: <Bzn05H.nq@jrd.dec.com> Sender: usenet@jrd.dec.com (USENET News System) Nntp-Posting-Host: jit533.jit.dec.com Reply-To: diamond@jit.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo References: <1992Dec21.225604.18749@netcom.com> Date: Tue, 22 Dec 1992 01:29:40 GMT Lines: 28