SA0042: Usage of different access paths
Function | Determines the usage of different access paths for the same variable. |
Reason | Different access to the same element reduces the readability and maintainability of a program. We recommend consistent use of {attribute 'qualified-only'} for libraries, global variable lists and enumerations. This forces fully qualified access. |
Importance | Low |
Samples:
In the following sample SA0042 is output as error/warning, because the global variable nGlobal is accessed directly and via the GVL namespace, and because the function CONCAT is accessed directly and via the library namespace.
Global variables:
VAR_GLOBAL
nGlobal : INT;
END_VARMAIN program:
PROGRAM MAIN
VAR
sVar : STRING;
END_VARnGlobal := INT#2; // => SA0042
GVL.nGlobal := INT#3; // => SA0042
sVar := CONCAT('ab', 'cd'); // => SA0042
sVar := Tc2_Standard.CONCAT('ab', 'cd'); // => SA0042