Hi Glynn,
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.
----- Original Message -----
From: "Glynn Clements" <[EMAIL PROTECTED]>
To: "Amit Dang" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Tuesday, August 02, 2005 4:24 PM
Subject: Re: Any pointer to Byte Alignment & Structure Padding?
>
> Amit Dang wrote:
>
> > Thanks Steve. So what is the best way of laying down a structure
definition
> > to over come cross platform issues?
> > I read about introducing some explicit padding in the structure to take
care
> > for cross platform issues but for that I suppose one should have
information
> > about byte alignment & structure padding on all targeted platforms. Is
that
> > true or there is some generic way of doing that? (Apart from using
compiler
> > option to remove any padding )
>
> Structure layout has nothing to do with portability. There's no reason
> why a structure needs to have the same layout on different platforms.
> In most situations, you don't need to know anything about how the
> structure is laid out; you just reference the fields.
>
> --
> Glynn Clements <[EMAIL PROTECTED]>
> -
> 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
-
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