Data structure alignment: Difference between revisions

Content deleted Content added
Bluebot (talk | contribs)
m Bringing "External links", "See also" and "Reference" sections in line with the Manual of Style.
No edit summary
Line 10:
If the type "short" is stored in two bytes of memory then each member of the data structure depicted above would be aligned to a boundary of 2 bytes. Data1 would be at offset 0, Data2 at offset 2 and Data3 at offset 4. The size of this structure after would be 6 bytes.
 
The type of each member of the structure usually has a required alignment, meaning that it will, unless otherwise requested by the programmer, be aligned on a pre-determined boundary. As a rule of thumb an integral data member will alignsalign to a boundary equal to its own size. The following typical requirements are valid for compilers from [[Microsoft]] and [[Borland]]:
 
A '''byte''' aligns to any '''byte''' boundary.<br/>