[libav-bugs] [Bug 712] Unchecked conversion from double to enum

bugzilla at libav.org bugzilla at libav.org
Wed Jul 30 00:38:33 CEST 2014


http://bugzilla.libav.org/show_bug.cgi?id=712

--- Comment #2 from nfxjfg at googlemail.com 2014-07-30 00:38:33 CEST ---
Asked someone who knows C a bit better than me, and he also was of the opinion
that the compiler is buggy and/or rejects valid code. He was giving the
following citations are from C99 (pasted from an IRC conversion):

<dalias> per 6.2.5 p16, enumerated types are integer types
<dalias> 6.3.1.4 p1 specifies what happens when a floating type is converted to
an integer type
<dalias> 6.5.16.1 p1 and p2 govern how this applies to the assignment operator
<dalias> wm4, 6.5.2.2 p2 says that the constraint on the arguments is that they
shall have a type that can be assigned to the type of the parameter
<dalias> wm4, so it defers to the paragraph i already gave you about assignment

So it seems this code is valid.

There's a patch on the mailing list to remove this code, which will probably
make it in, but I'm writing this so that you can avoid creating a compiler
which invents its own C semantics. (Happened to clang a few times.)

-- 
Configure bugmail: http://bugzilla.libav.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the libav-bugs mailing list