[vlc-devel] [PATCH 17/22] vlc_arrays: DictHash output is always used as an int
vlc at filcab.net
Mon Aug 3 18:23:50 CEST 2015
I finally understood what my mistake was. We always do ‘% hashsize” before returning, which will “obviously” “never" be greater than 2^32 (I’m pretty sure there could be other problems before we got to that size).
-Wshorten-64-to-32 should warn on coercing uint64_t to int, for clang.
> On Aug 3, 2015, at 05:30, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2015-08-02 22:24, Filipe Cabecinhas a écrit :
>>> Of course not. Conversion from an integer type to a *signed*
>>> integer type is
>>> always exact in C. The number of bits of both types is irrelevant.
>> Its implementation dependent but exact, yes.
> No. Just no.
> The spec says it is exact, GCC and clang assume it is exact, and VLC uses it such that it is exact.
>> What Im saying is that int might be 32 bits
>> and you might only get the bottom 32 bits
> No. No. No. You get the same value. The high-order zero bits will be discarded, but that does obviously not change the actual value.
> MSVC seems to have either some super-strict or super-dumb overflow warnings. I was not able to find an equivalent warning in GCC (-Wstrict-overflow does not seem to cover type conversions).
> Rémi Denis-Courmont
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
More information about the vlc-devel