Article View: comp.std.c
Article #1288Re: Can an enumerator be assigned to an int?
From: Karl Heuer
Date: Fri, 25 May 1990 17:03
Date: Fri, 25 May 1990 17:03
26 lines
1741 bytes
1741 bytes
In article <1421@sdrc.UUCP> gcglan@sdrc.UUCP (Frank Glandorf) writes:
> a=CIRCLE;
>%CC-W-ENUMCLASH, Mismatched enum type in "=" operation.
^
I presume from this codeletter that the implementation did not in fact
terminate the compilation as a result of the mismatch.
>I think this should be ok because according to section 3.5.2.2...
>"The identifiers in an enumerator list are delcared as
>constants that have type int and may appear wherever such are
>permitted."
2.1.1.3 footnote 6: "Of course, an implementation is free to produce any
number of [warning] diagnostics". A.5 common warnings: "A value is given to
an object of enumeration type other than by assignment of [something of the
same enumeration type]."
In diagnosing violations of the strong-enum model, the implementation is
(a) legally in the right (as long as it is only a warning) and also (b)
morally in the right (as long as there is an option to disable the warning).
Clause (a) is a fact. (b) is my opinion, and I stand by it even though the
example in A.5 involves a copy in the direction opposite that of the posted
code fragment.
Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint
Technical Details
Message-ID:
<16728@haddock.ima.isc.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!haddock!karlReferences:
<1421@sdrc.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.std.c Subject: Re: Can an enumerator be assigned to an int? Keywords: VAX/VMS C issues warning Message-ID: <16728@haddock.ima.isc.com> Date: 25 May 90 17:03:54 GMT References: <1421@sdrc.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Distribution: na Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 26