Configuration | Rules 4.2.1.2.7 SA0027: Multiple usage of name | SA0027: Multiple usage of name Sample: The following sample generates error/warning SA0027, since the library Tc2_Standard is referenced in the project, which provides the function block TON. PROGRAM MAIN VAR ton : INT; // => SA0027 END_VAR 4.2.1.2.8 SA0028: Overlapping memory areas | SA0028: Overlapping memory areas This rule can only be checked using the Command 'Run static analysis' [ } 110] command, not using the “Check all objects” option. Sample: In the following sample both variables use byte 21, i.e. the memory areas of the variables overlap. PROGRAM MAIN VAR nVar1 AT%QB21 : INT; // => SA0028 nVar2 AT%QD5 :
DWORD; // => SA0028 END_VAR TE1200 33 Version: 2.11.1 Function Determines multiple use of a variable name/identifier or object name (POU) within the scope of a project. The following cases are covered: • The name of an enumeration constant is identical to the name in another enumeration within the application or in an included library. • The name of a variable is identical to the name of another object in the application or in an included library. • The name of a variable is identical to the name of an enumeration constant in an enumeration in the application or in an included library.
• The name of an object is identical to the name of another object in the application or in an included library. Reason Identical names can be confusing when reading the code. They can lead to errors if the wrong object is accessed inadvertently. Therefore, define and follow naming conventions in order to avoid such situations. Exception Enumerations declared with the 'qualified only' attribute are exempt from SA0027 _ checking because their elements can only be accessed in a qualified manner. Importance Medium Function Determines the points due to which two or more variables occupy the same storage space.
Reason If two variables occupy the same storage space, the code may behave very unexpectedly. This must be avoided in all cases. If the use of a value in different interpretations is unavoidable, for example once as DINT and once as REAL, you should define a UNION. Also, via a pointer you can access a value typed otherwise without converting the value. Importance High