SA0044: Declarations with reference to interface
Detects declarations with REFERENCE TO interfaces and declarations of VAR_IN_OUT variables with interfaces (implicitly implemented by means of REFERENCE TO)
Justification: An interface type is always implicitly a reference to an instance of a function block that implements this interface. A reference to an interface is therefore a reference to a reference and can result in unwanted behavior.
Importance: High
Example 53. Example
ITF is an interface which is defined in the project.
FUNCTION_BLOCK POU
VAR_INPUT
inst_itf2 : ITF;
END_VAR
VAR_OUTPUT
inst_itf3 : ITF;
END_VAR
VAR_IN_OUT
inst_itf4 : ITF; // SA0044
END_VAR
PROGRAM PLC_PRG
VAR
inst : POU;
itf_inst1 : ITF;
itf_ref : REFERENCE TO ITF; // SA0044
END_VAROutput in the Messages view:
SA0044: Reference to interface 'itf4_ref'
SA0044: Reference to interface 'itf_ref'