SA0061: Unusual operation on pointer
Function | Determines operations on variables of type POINTER TO, which are not = (equality), <> (inequality), + (addition) or ADR. |
Reason | Pointer arithmetic is generally permitted in TwinCAT and can be used in a meaningful way. The addition of a pointer with an integer value is therefore classified as a common operation on pointers. This makes it possible to process an array of variable length using a pointer. All other (unusual) operations with pointers are reported with SA0061. |
Importance | High |
PLCopen rule | E2/E3 |
Samples:
PROGRAM MAIN
VAR
pINT : POINTER TO INT;
nVar : INT;
END_VARpINT := ADR(nVar); // no error
pINT := pINT * DWORD#5; // => SA0061
pINT := pINT / DWORD#2; // => SA0061
pINT := pINT MOD DWORD#3; // => SA0061
pINT := pINT + DWORD#1; // no error
pINT := pINT - DWORD#1; // => SA0061