[vlc-devel] [PATCH 17/22] vlc_arrays: DictHash output is always used as an int

Rémi Denis-Courmont remi at remlab.net
Mon Aug 3 14:30:42 CEST 2015


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
http://www.remlab.net/



More information about the vlc-devel mailing list