[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


--- 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> p1 specifies what happens when a floating type is converted to
an integer type
<dalias> p1 and p2 govern how this applies to the assignment operator
<dalias> wm4, 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