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
ITF
is an interface that is defined in the project.
PROGRAM PLC_PRG VAR inst:POU; itf_inst1 : ITF; itf_ref : REFERENCE TO ITF; // SA0044 END_VAR 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 --> SA0044: Reference to interface 'itf_ref' --> SA0044: Reference to interface 'itf4_ref'