Skip to main content

SA0027: Multiple uses of identifiers

Detects multiple uses of a name/identifier for a variable or an object (POU) within the scope of a project.

In the case of enumerations, the qualified name is taken into account.

Justification: Same names can be confusing when reading the code. They can cause errors if the wrong object is accessed accidentally. Define and follow naming conventions to avoid any situation like this.

The following cases are detected:

  • The name of an enumeration is identical to the name of another enumeration in the application or in an integrated library.

  • The name of a variable is identical to the name of another object in the application or in an integrated library.

  • The name of a variable is identical to the name of an enumeration constant in an enumeration in the application or in an integrated library.

  • The name of an object is identical to the name of another object in the application or in an integrated library.

Importance: Medium

Example 39. Example
TYPE COLOR :
(
    red,
    green,
    blue
);
END_TYPE
PROGRAM PLC_PRG
VAR
    color : INT;
END_VAR

Output in the Messages view:

  • sa_icon_message.png SA0027: Variable name 'color' in 'PLC_PRG' is already used for an object in this application



For more information, see: