Redigera

Warning C6323

Use of arithmetic operator on Boolean type(s)

Remarks

This warning occurs if arithmetic operators are used on Boolean data types. Use of incorrect operator might yield incorrect results. It also indicates that the programmer's intent isn't reflected in the code.

Code analysis name: ARITH_OP_ON_BOOL

Example

The following code generates this warning:

int test(bool a, bool b)
{
    int c = a + b;     //C6323
    return c;
}

To correct this warning, use correct data type and operator.

int test(int a, int b)
{
    int c = a + b;
    return c;
}