SA0061: Unusual operation on pointer

Detects operations one variables of type POINTER TO which are not = (equality), <> (inequality), + (addition), or ADR.

In CODESYS, pointer arithmetic is generally permitted and can also be used appropriately. Therefore, the addition of a pointer with an integer value is considered a common operation on pointers. This makes it possible to use a pointer to process an array of variable length. All other (unusual) operations with pointers are reported with SA0061.

Importance: High

PLCopen rule: E2 / E3

Example

PROGRAM PLC_PRG
VAR
        piTemp : POINTER TO INT;
        iTemp : INT;
END_VAR

iTemp := iTemp + INT#1;
piTemp := ADR(iTemp);
piTemp := piTemp * DWORD#5;   // SA0061
piTemp := piTemp / DWORD#2;   // SA0061
piTemp := piTemp MOD DWORD#3; // SA0061
piTemp := piTemp + DWORD#1;
piTemp := piTemp - DWORD#1;   // SA0061

--> SA0061: Unübliche Operation auf Pointer