RAD Studio |  |

W8060: Possibly incorrect assignment (C++)

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

This warning is generated when the compiler encounters an assignment operator as the main operator of a conditional expression (part of an if, while, or do-while statement).

This is usually a typographical error for the equality operator.

If you want to suppress this warning, enclose the assignment in parentheses and compare the whole thing to zero explicitly.

For example, this code

Copy Code

    if (a = b) ...

should be rewritten as

Copy Code

    if ((a = b) != 0) ...

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