C6319
warning C6319: use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects
This warning indicates an ignored sub-expression in test context because of the comma-operator (,). The comma operator has left-to-right associativity. The result of the comma-operator is the last expression evaluated. If the left expression to comma-operator has no side effects, the compiler might omit code generation for the expression.
Example
The following code generates this warning:
void f()
{
int i;
int x[10];
// code
for ( i = 0; x[i] != 0, x[i] < 42; i+) // warning
{
// code
}
}
To correct this warning, use the logical AND operator as shown in the following code:
void f()
{
int i;
int x[10];
// code
for ( i = 0; (x[i] != 0) && (x[i] < 42); i+)
{
// code
}
}