Wiki Markup |
---|
The size of a structure is not always equal to the sum of the sizes of its members. According to Section 6.7.2.1 of the C99 standard, "There may be unnamed padding within a structure object, but not at its beginning" \[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\]. |
...
Wiki Markup |
---|
This noncompliant code example assumes that the size of {{struct buffer}} is equal to the sum of the size of its individual components, which may not be the case \[[Dowd 06|AA. C References#Dowd 06]\]. The size of {{struct buffer}} may actually be larger due to structure padding. |
...
Wiki Markup |
---|
\[[Dowd 06|AA. C References#Dowd 06]\] Chapter 6, "C Language Issues" (Structure Padding 284-287) \[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Section 6.7.2.1, "Structure and union specifiers" \[[Sloss 04|AA. C References#Sloss 04]\] Section 5.7, "Structure Arrangement" |
...