Can an enumerator be assigned to an int?
Karl Heuer
karl at haddock.ima.isc.com
Sat May 26 03:03:54 AEST 1990
In article <1421 at sdrc.UUCP> gcglan at 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 at ima.ima.isc.com or harvard!ima!karl), The Walking Lint
More information about the Comp.std.c
mailing list