gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scary warning about casts


From: Riccardo Mottola
Subject: scary warning about casts
Date: Fri, 26 Nov 2021 12:22:42 +0100
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 SeaMonkey/2.53.8

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]