SA0017: Unusual assignment to pointer variable
Detects assignments to pointers which are neither addresses (ADR
operator, pointer variables) nor constants 0
Justification: If a pointer is assigned a value which is not a valid address, then the dereferencing of the pointer leads to an "Access Violation Exception".
Importance: High
Example 30. Example
PROGRAM PLC_PRG VAR pInt : POINTER TO INT; dwAddress : DWORD; END_VAR
dwAddress := dwAddress + DWORD#1; pInt := dwAddress; // SA0017
Output in the Messages view:
SA0017: Unusual assignment to pointer variable