RAD Studio |  |

W8012: Comparing signed and unsigned values (C++)
Example
Collapse All

(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.

Example
Copy Code

    #pragma warn +csu
    boolfoo(unsigned u, int i)
    {
    return u < i;
    }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!