RAD Studio
ContentsIndex
PreviousUpNext
W8012: Comparing signed and unsigned values

(Command-line option to suppress warning: -w-csu) 

Since the ranges of signed and unsigned types are different the result of an ordered comparison of an unsigned and a signed value might have an unexpected result. 

 

#pragma warn +csu
boolfoo(unsigned u, int i)
{
return u < i;
}
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!