Detects implicitly generated pointer conversions
Justification: In CODESYS, pointers are not strictly typed and they can be assigned to each other in any way.
This is often used and therefore not reported by the compiler. However, it can also
accidentally cause unexpected access. If you assign a POINTER TO BYTE
to a POINTER TO DWORD
, then you can unintentionally overwrite memory using the latter pointer. Therefore,
always check this rule and block the message for cases in which you intentionally
want to access a value with a different type.
Implicit data type conversions are reported with a different message.
Importance: High
PLCopen rule: CP25
Exception: BOOL
<-> BIT
Example
PROGRAM PLC_PRG VAR pINT : POINTER TO INT; byteVar : BYTE; END_VAR pINT := ADR(byteVar); --> SA0019: Implicit conversion from pointer to 'POINTER TO BYTE' to pointer to 'POINTER TO INT'