beckhoff TE1200 — 4.2.1.4.9 SA0075: Missing ELSE

Configuration | Rules nIndex := nIndex + 1; // => SA0072 nIndex := nLocal; // => SA0072 END_FOR 4.2.1.4.8 SA0073: Use of non-temporary counter variable | SA0073: Use of non-temporary counter variable Sample: PROGRAM MAIN VAR nIndex : INT; nSum : INT; END_VAR FOR nIndex := 1 TO 10 BY 1 DO // => SA0073 nSum := nSum + nIndex; END_FOR 4.2.1.4.9 SA0075: Missing ELSE | SA0075: Missing ELSE Sample: {attribute 'qualified_only'} {attribute 'strict'} {attribute 'to_string'} TYPE E_Sample : ( eNull, eOne, eTwo ); END_TYPE PROGRAM MAIN VAR eSample : E_Sample; nVar : INT; END_VAR CASE eSample OF E_Sample.eNull: nVar := 0; E_Sample.eOne: nVar := 1; E_Sample.eTwo:

nVar := 2; END_CASE CASE eSample OF // => SA0075 E_Sample.eNull: nVar := 0; E_Sample.eTwo: nVar := 2; END_CASE TE1200 52 Version: 2.11.1 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 Function Determines CASE statements without ELSE branch. Reason Defensive programming requires the presence of an ELSE in every CASE statement.

If no action is required in the ELSE case, you should indicate this with a comment. The reader of the code is then aware that the case was not simply overlooked. Exception A missing ELSE branch is not reported as missing if an enumeration declared with the 'strict' attribute is used in the CASE statement, and if all enumeration constants are listed in that CASE statement. Importance Low PLCopen rule L17