SA0005: Invalid addresses and data types
Detects invalid addresses and data type specifications. Valid size prefixes in addresses: X for BOOL
B for 1-byte data types, W for 2-byte data types, and D for 4-byte data types.
Justification: Variables located on direct addresses should preferably be associated with an address that corresponds to their data type width. It can be confusing for the reader of the code, for example, if a DWORD
is assigned to a BYTE
address.
Importance: Low
Example 58. Example
PROGRAM Check_Address_Type_PRG VAR iVar AT %QB0 : INT ; // OK e. g.: %QW0 xTest AT %QW1 : BOOL ; // OK e. g.: %QX1.0 END_VAR
iVar := iVar + INT#1; xTest := NOT xTest;
Output in the Messages view:
SA0005: Invalid address for data type 'iVar'
For more information, see: