readability-misplaced-array-index.rst 559 Bytes

readability-misplaced-array-index

This check warns for unusual array index syntax.

The following code has unusual array index syntax:

void f(int *X, int Y) {
  Y[X] = 0;
}

becomes

void f(int *X, int Y) {
  X[Y] = 0;
}
The check warns about such unusual syntax for readability reasons:
  • There are programmers that are not familiar with this unusual syntax.
  • It is possible that variables are mixed up.