SA0016: Gaps in structures
Detects gaps in structures or function blocks which are caused by the alignment requirements of the currently set target system. If possible, you should remove the gaps by resorting the structure elements or filling them with a dummy element. If this is not possible, then you can deactivate the rule for the affected structures by means of the analysis
pragma.
Justification: Due to different alignment requirements on different platforms, there may be a different layout in the memory for these kinds of structures. Then the code can perform differently, depending on the platform.
Importance: Low
TYPE Unpadded_Structure : STRUCT xTest : BOOL; iTest : INT; // SA0016 byTest : BYTE; wTest : WORD; END_STRUCT END_TYPE
PROGRAM PLC_PRG VAR myStruct : Unpadded_Structure; END_VAR
myStruct.iTest := 0;
Output in the Messages view:
SA0016: Structure 'Unpadded_Structure' must be padded (pack-mode=8)