Detects the use of non-temporary variables in FOR
loops.
Justification: This is a performance warning. A counter variable is always initialized
each time a POU is called. You can create this variable as a temporary variable (VAR_TEMP
). Access to it may be faster and the variable does not take up any permanent memory.
Importance: Medium
PLCopen rule: CP21 / L13
Example
PROGRAM PLC_PRG VAR nIndex : INT; iVar : INT; END_VAR FOR nIndex := INT#0 TO INT#20 BY INT#1 DO iVar := iVar + nIndex; END_FOR --> SA0073: Inadequate counter variable