SA0016: Gaps in structures
Function | Determines gaps in structures or function blocks, caused by the alignment requirements of the currently selected target system. If possible, you should remove gaps by rearranging the structure elements or by filling them with dummy elements. If this is not possible, you can disable the rule for the affected structures using the attribute {attribute 'analysis' := '...'}. |
Reason | Due to different alignment requirements on different platforms, such structures may have a different layout in the memory. The code may behave differently, depending on the platform. |
Importance | Low |
Samples:
TYPE ST_UnpaddedStructure1 :
STRUCT
bBOOL : BOOL;
nINT : INT; // => SA0016
nBYTE : BYTE;
nWORD : WORD;
END_STRUCT
END_TYPETYPE ST_UnpaddedStructure2 :
STRUCT
bBOOL : WORD;
nINT : INT;
nBYTE : BYTE;
nWORD : WORD; // => SA0016
END_STRUCT
END_TYPE