SA0073: Use of non-temporary counter variable
Function | Determines the use of non-temporary variables in FOR loops. |
Reason | This is a performance warning. A counter variable is always initialized each time a programming block is called. You can create such a variable as a temporary variable (VAR_TEMP). This may result in faster access, and the variable does not occupy permanent storage space. |
Importance | Medium |
PLCopen rule | CP21/L13 |
Sample:
PROGRAM MAIN
VAR
nIndex : INT;
nSum : INT;
END_VARFOR nIndex := 1 TO 10 BY 1 DO // => SA0073
nSum := nSum + nIndex;
END_FOR