[IRCServices Coding] GCC3

Trevor Talbot quension at softhome.net
Tue Feb 26 08:09:26 PST 2002


On Tuesday, February 26, 2002, at 12:19  AM, Finny Merrill wrote:

> On Tue, 26 Feb 2002, Andrew Church wrote:
>
>>> Plus if you did this:
>>>
>>> struct {
>>>  int8_t byte;
>>>  /* 8 bits of padding */
>>>  int16_t word1, word2;
>>>  /* 16 bits of padding! */
>>> } bar;
>>>
>>> it pads the extra 16 bits so it's on a 32 bit boundary.
>>
>>      Um, no it doesn't:
> You're right. Unlike some compilers, GCC doesn't pad types
> at the end. It still aligns statics and autos on the 32 bit
> boundary, but if you malloced it, there would still be the extra
> 16 bits.

Without meaning any offense, you're full of odd misinformation.
Variables of static and auto duration have no alignment other
than the size of their type; malloc() has nothing to do with
padding at all.  And gcc will pad structs wherever is required
(including the end), except at the beginning.

-- Quension