Re: Data Alignment
Re: Data Alignment
- Subject: Re: Data Alignment
- From: Mark Wagner <email@hidden>
- Date: Mon, 20 Aug 2012 13:13:35 -0700
A better solution is to read the structure from the file one field at
a time. This will continue to work even on architectures/compilers
that don't support the alignment you need, and will make your code
independent of changes in things like byte ordering or variable sizes.
--
Mark Wagner
On Thu, Aug 16, 2012 at 12:41 PM, koko <email@hidden> wrote:
> I spoke too soon.
>
> use __attribute__((__packed__))
>
> on all structures that msu go between arch's.
>
>
> On Aug 16, 2012, at 1:05 PM, koko wrote:
>
> I have a data structure that was created and only used on PPC some time ago.
>
> I now must use this same structure on x86 and then on PPC.
>
> That is the structure represents a record, data comes in, the structure is
> updated and written to a file by an x86 program.
>
> Now the written file must be used on PPC. (Note: I do know i need to handle
> endianess but alignment first.)
>
> On PPC the sizeof(struct) is 134 on x86 it is 140.
>
> How do I deal with this? Id there a compiler / linker setting to non-align …
> is this a #pragma or something?
>
> Help!
>
> -koko
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden