xsharp.eu • Compare with constants, warning XS9021, with /vo4
Page 1 of 1

Compare with constants, warning XS9021, with /vo4

Posted: Tue Feb 18, 2020 10:27 am
by wriedmann
Hello,
with the new build I have a lot of warnings about compare operations with Windows API constants, for example:

Code: Select all

case struNotify._Code == HDN_BEGINDRAG
gives a warning

Code: Select all

warning XS9021: Signed/unsigned conversions from 'int' to 'dword' may lead to loss of data or overflow errors
The member _code of struNotify is defined as

Code: Select all

export _code as dword
and the define in the VO Windows API lib seems to be an int.
Strangely enough, this is occurring only on defines, and not on normal ints.
This is a sample:
DefineTester.zip
(1.14 KiB) Downloaded 36 times
Wolfgang

Compare with constants, warning XS9021, with /vo4

Posted: Tue Feb 18, 2020 10:52 am
by Karl-Heinz
Hi Wolfgang,

I also noticed this additional /vo4 behavior. i unchecked the /vo4 setting and in my ownerdraw lib no more XS9021 warnings are thrown. I´ve also tried that with the Hoverlib. But now other warnings and even errors are thrown, But the hoverlib is a (very) special one.

regards
Karl-Heinz

Compare with constants, warning XS9021, with /vo4

Posted: Tue Feb 18, 2020 11:17 am
by robert
Wolfgang,

I'll see what I can do.

Robert

Compare with constants, warning XS9021, with /vo4

Posted: Tue Feb 18, 2020 11:29 am
by wriedmann
Hi Robert,
thank you very much!
Wolfgang

Compare with constants, warning XS9021, with /vo4

Posted: Fri Mar 06, 2020 8:23 pm
by Kees Bouw
Hi,

This warning XS9021 appeared in my code 20 times, in every case in code like this:

LOCAL dwLength AS DWORD
dwLength := SLen(cString)

Since SLen returns a DWORD and dwLength is also a DWORD, I can't explain this warning.

When I change SLen to Len, the warning disappears.

The warning also disappears if I set "Implicit signed/unsigned conversions" to False in the Dialect settings of the project. I would expect the opposite to happen.

I have chosen the last solution to fix this but there is probably something wrong here.

Kind regards,

Kees.

Compare with constants, warning XS9021, with /vo4

Posted: Fri Mar 06, 2020 9:26 pm
by Chris
Hi Kees,

Yes, this is a bug in the latest X# version, it will be fixed in the next one. Please ignore this warning for now.