On Tue, Aug 02, 2005 at 03:02:35PM +0530, Amit Dang wrote:

>     You are very right in saying that "there is no need for structures to
> have same layout on different platform" until structures are being written
> directly to the file system. But many time there is a requirement that the
> data file can be moved across platforms.

 In that case use __attribute__ ((packed)) after the structure definition.
There'll be no alignment then and the size will always be the same.

        struct hihi{
                int a ;
                char b ;
        } __attribute__ ((packed)) ;

Attachment: pgpvoRPG6X4NO.pgp
Description: PGP signature

Reply via email to