[EMAIL PROTECTED] wrote:

> Padding at the end of a structure is often required by the ABI.
>
>
> Take, e.g., a structure like this:
>
>       struct weird {
>               int x;
>               char c;
>       };
>
> the ABI requires that "x" is aligned on a 4 byte boundary and that
> means that sizeof(struct weird) is required to be a multiple of 4.
>
> That's the only way to make arrays  "struct weird bits[10];"
> work correctly.

This is correct, but gcc seems to pad structures that don't need this
because they are written the right way. Thay start with a character
element and they have only members that are either characters or arrays of 
characters. 

It is obvious that you cannot write portable structure definitions that
include objects > sizeof char and are not internally aligned in a way
that could allow to be used in an unpadded way.

Jörg

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
       [EMAIL PROTECTED]                (uni)  
       [EMAIL PROTECTED]     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to