beckhoff TE1200 — 4.2.1.4.4 SA0064: Addition of pointer

Configuration | Rules 4.2.1.4.3 SA0063: Possibly not 16-bit-compatible operations | SA0063: Possibly not 16-bit-compatible operations Sample: (nVar+10) can exceed 16 bits. PROGRAM MAIN VAR nVar : INT; END_VAR nVar := (nVar + 10) / 2; // => SA0063 4.2.1.4.4 SA0064: Addition of pointer | SA0064: Addition of pointer Samples: PROGRAM MAIN VAR aTest : ARRAY[0..10] OF INT; pINT : POINTER TO INT; nIdx : INT; END_VAR pINT := ADR(aTest[0]); pINT^ := 0; pINT := ADR(aTest) + SIZEOF(INT); // => SA0064 pINT^ := 1; pINT := ADR(aTest) + 6; // => SA0064 pINT := ADR(aTest[10]); FOR nIdx := 0 TO 10 DO pINT^ := nIdx; pINT := pINT + 2; // => SA0064 END_FOR TE1200 49 Version:

2.11.1 Function Determines 16-bit operations with intermediate results. Background: On 16-bit systems, 32-bit temporary results can be truncated. Reason This message is intended to protect against problems in the very rare case when code is written that is intended to run on both a 16-bit processor and a 32-bit processor. Importance Low Function Determines all pointer additions. Reason In TwinCAT, pointer arithmetic is generally permitted and can be used sensibly. However, this also represents a source of error. Therefore, there are programming rules that prohibit pointer arithmetic. Such a requirement can be verified with this test. Importance Medium