Configuration | Rules bPointer := pStruct^.bTest; // => SA0039: Possible null pointer dereference 'pStruct^' bRef := refStruct.bTest; // => SA0145: Possible use of not initialized reference 'refStruct' IF pStruct 0 THEN bPointer := pStruct^.bTest; // no error SA0039 as the pointer is checked for unequal 0 END_IF IF __ISVALIDREF(refStruct) THEN bRef := refStruct.bTest; // no error SA0145 as the reference is checked via __ISVALIDREF END_IF Overview of the rules on "dereferencing" 4.2.1.2.19 SA0040: Possible division by zero | SA0040: Possible division by zero Sample: PROGRAM MAIN VAR CONSTANT cSample : INT := 100; END_VAR VAR nQuotient1 : INT; nDividend1 : INT; nDivisor1 : INT; nQuotient2 :
INT; nDividend2 : INT; nDivisor2 : INT; END_VAR nDivisor1 := cSample; nQuotient1 := nDividend1/nDivisor1; // no error nQuotient2 := nDividend2/nDivisor2; // => SA0040 TE1200 38 Version: 2.11.1 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] Function Determines code positions at which division by zero may occur. Reason Division by 0 is not allowed. A variable that is used as a divisor should always be checked for 0 first. Otherwise, a "Divide by Zero" exception may occur at runtime. Importance High