W1021 Comparison always evaluates to False (Object Pascal)
The compiler has determined that the expression will always evaluate to False. This most often can be the result of a boundary test against a specific variable type, for example, a Integer against $80000000.
In versions of the Object Pascal compiler prior to 12.0, the hexadecimal constant $80000000 would have been a negative Integer value, but with the introduction of the int64 type, this same constant now becomes a positive int64 type. As a result, comparisons of this constant against Integer variables will no longer behave as they once did.
As this is a warning rather than an error, there is no standard method of addressing the problems: sometimes the warning can be ignored, sometimes the code must be rewritten.
program Produce; var i : Integer; c : Cardinal; begin c := 0; i := 0; if c < 0 then Writeln('false'); if i >= $80000000 then Writeln('false'); end.
Here the compiler determines that the two expressions will always be False. In the first case, a Cardinal, which is unsigned, can never be less than 0. In the second case, a 32-bit Integer value can never be larger than, or even equal to, an int64 value of $80000000.