[vlc-devel] [PATCH 17/22] vlc_arrays: DictHash output is always used as an int
Rémi Denis-Courmont
remi at remlab.net
Sun Aug 2 20:59:25 CEST 2015
Le samedi 01 août 2015, 21:21:02 Francois Cartegnie a écrit :
> >> This makes no sense.
> >
> > The variable is a uint64_t, the function returns an int. Some
> > compilers will tell you the implied cast may be wrong, we just say
> > it's correct.
>
> Correct fix is in checking and casting hashsize.
First, there are no bugs here. Maybe the choice of type is sub-optimal but the
code seems perfectly fine.
The ideal fix is to use the best suited types where possible. But we cannot
add integer casts all over the place. Until/unless GCC and clang start showing
the same warnings, that will simply not work. Besides, it would clutter the
code for no reasons: I don´t think an explicit cast makes the code looks any
better.
> Not losing precision.
What the heck does that even mean? Neither converting implicitly nor casting
explicitly to int (or any other signed type) can lose precision.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list