Given that the cast is implicit this is left up to the compiler to
determine.  Luckily GCC and clang (our only supported compilers) do this in
the way we expect.  I suggest that we do a little better and do the
conversion in a more predictable way so that we don't depend on undefined
and/or compiler-specific behavior.  GC


On Fri, Nov 26, 2021 at 6:23 AM Riccardo Mottola <riccardo.mott...@libero.it>
wrote:

> Hello
>
> I noticed I get these warnings, which look a bit scary.
>
>  Compiling file XGServerWindow.m ...
> XGServerWindow.m:3960:40: warning: implicit conversion from 'unsigned
> int' to 'float' changes value from 4294967295 to
>       4294967296 [-Wimplicit-int-float-conversion]
>       opacity = (unsigned int)(alpha * 0xffffffffU);
>                                      ~ ^~~~~~~~~~~
> XGServerWindow.m:3996:31: warning: implicit conversion from 'unsigned
> int' to 'float' changes value from 4294967295 to
>       4294967296 [-Wimplicit-int-float-conversion]
>         alpha = (float)*num / 0xffffffffU;
>
>
> I think the warning is legit: alpha is float and is multiplied with an
> explicit unsigned constant 0xffffffffU.
>
> What is the code trying to achieve here?
>
> Riccardo
>
>

-- 
Gregory Casamento
GNUstep Lead Developer / OLC, Principal Consultant
http://www.gnustep.org - http://heronsperch.blogspot.com
https://www.patreon.com/bePatron?u=352392 - Become a Patron
https://gf.me/u/x8m3sx - My GNUstep GoFundMe
https://teespring.com/stores/gnustep - Store

Reply via email to