POINTER TO is type-unsafe
Variables defined as a POINTER TO data-type are considered type-unsafe in the sense that
assigning between incompatible types will not be caught. For example the following
code, while incorrect, will not return any diagnostics when compiling:
VAR
stringVar : STRING;
unsafePtrA : POINTER TO DINT := ADR(stringVar);
unsafePtrB : POINTER TO DINT := REF(stringVar);
END_VAR
Note that for class and function block hierarchies, POINTER TO assignments are validated —
the compiler checks that the pointee types are related via EXTENDS (see E125).
POINTER TO is the recommended mechanism for polymorphism per IEC 61131-3.
For other types, consider using REF_TO instead of POINTER TO, which is a type-safe
alternative and should catch type-mismatches early on.