Configuration | Rules iSample : I_Sample; refItf : REFERENCE TO I_Sample; // => SA0044 END_VAR 4.2.1.3.5 SA0046: Possible use of not initialized interfaces | SA0046: Possible use of not initialized interfaces Samples: Interface I_Sample: INTERFACE I_Sample METHOD SampleMethod : BOOL VAR_INPUT nInput : INT; END_VAR Function block FB_Sample: FUNCTION_BLOCK FB_Sample IMPLEMENTS I_Sample METHOD SampleMethod : BOOL VAR_INPUT nInput : INT; END_VAR MAIN program: PROGRAM MAIN VAR fbSample : FB_Sample; iSample : I_Sample; iSampleNotSet : I_Sample; nParam : INT; bReturn :
BOOL; END_VAR iSample := fbSample; bReturn := iSample.SampleMethod(nInput := nParam); // no error bReturn := iSampleNotSet.SampleMethod(nInput := nParam); // => SA0046 Overview of the rules on "dereferencing" TE1200 41 Version: 2.11.1 Function Determines the use of interfaces that may not have been initialized before the use. Reason An interface reference should be checked for 0 before it is used, otherwise an access violation may occur at runtime. Importance High Pointer Dereferencing of pointers in the declaration part SA0124: Dereference access in initializations [} 66] Possible null pointer dereferences in the implementation part SA0039:
Possible null pointer dereferences [} 37] References Use of references in the declaration part SA0125: References in initializations [} 66] Possible use of not initialized reference in the implementation part SA0145: Possible use of not initialized references [} 69] Interfaces Possible use of not initialized interface in the implementation part SA0046: Possible use of not initialized interfaces [} 41]