Compiler Warning (level 4) C4709

comma operator within array index expression

The value used as an index into an array was the last one of multiple expressions separated by the comma operator.

An array index legally may be the value of the last expression in a series of expressions separated by the comma operator. However, the intent may have been to use the expressions to specify multiple indexes into a multidimensional array.

For example, the following line, which generates this warning, is legal in C and specifies the index c into array a:

a[b,c]

However, the following line uses both b and c as indexes into a two-dimensional array:

a[b][c]

The following examples generate this warning:

p = new int [2,3];   //C4709
delete[2,4] p;      //C4709

In the following example multiple warnings are generated:

a[i,j]=a[i, a[i,j]]