SA0180: Index range does not cover the entire array
Function | Determines arrays with an index range that is not completely covered. |
Reason | Arrays are often handled in loops, with the loop index indexing the array in such a way that all components of the array are accessed without gaps. This is the case if the loop index and the array index are the same in all dimensions. If the index range does not completely cover the array, this indicates components in the array that have not been processed. |
Importance | Medium |
Sample:
PROGRAM MAIN
VAR_TEMP
nIndex : INT;
END_VAR
VAR
aSample : ARRAY[0..10] OF INT;
END_VARFOR nIndex := INT#1 TO INT#10 DO
aSample[nIndex] := 0; // => SA0180
END_FOR