Hi Progga,
    Thanks for the reply. Yes, __attribute__(packed) can be used but that
comes with processing overhead. I read some where on net (I am not very sure
about that), all compilers do not support such construct.

Regards,
Amit Dang
----- Original Message ----- 
From: "Progga" <[EMAIL PROTECTED]>
To: "Amit Dang" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Tuesday, August 02, 2005 4:38 PM
Subject: Re: Any pointer to Byte Alignment & Structure Padding?
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)) ;



-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" 
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to