SA0016: Gaps in structures

Detects gaps in structures or function blocks that 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

Example

PROGRAM PLC_PRG
VAR
        myStruct : Unpadded_Structure;
END_VAR
myStruct.iTest := 0;

TYPE Unpadded_Structure :
STRUCT
        xTest : BOOL;
        iTest : INT;    // SA0016
        byTest : BYTE;
        wTest : WORD;
END_STRUCT
END_TYPE

--> SA0016: Struktur 'Unpadded_Structure' muss aufgefüllt werden (Pack Modus=8)