SA0064: Addition of pointer
Detects the addition of pointers
Justification: In CODESYS, pointer arithmetic is generally permitted and can also be used appropriately. However, it also represents a source of error. Therefore, programming rules exist that generally prohibit pointer arithmetic. This test can check such a requirement.
Importance: Medium
Example 75. Example
PROGRAM PLC_PRG
VAR
    iTest : INT;
    ariTest : ARRAY[0..10] OF INT;
    {attribute 'analysis':='-111'}
    piTest : POINTER TO INT;
    i : INT;
END_VAR
piTest := ADR(ariTest[0]);    // OK
piTest^ := 0;
piTest := ADR(ariTest) + SIZEOF(INT);    // SA0064
piTest^ := 1;
piTest := ADR(ariTest) + 6;    // SA0064
piTest^ := 3;
piTest := ADR(ariTest[10]);
FOR i:=0 TO 10 DO
    piTest^ := i;
    piTest := piTest + 2;    // SA0064
END_FOROutput in the Messages view:
 SA0064: Addition of pointer