Re: 4 vs 8 alignment
Re: 4 vs 8 alignment
- Subject: Re: 4 vs 8 alignment
- From: David Fang <email@hidden>
- Date: Tue, 12 Dec 2006 23:51:30 -0500 (EST)
> I have a structure thats being read on the PC, that was originally
> packed on the mac side. The struct seems to be 4 byte aligned on the
> Mac, but the struct is 8 byte aligned on the PC ( 172 bytes on the mac
> vs 176 on the pc )
>
> Is there a pragma setting or a setting in xcode that can guarantee the
> data will be packed in 8 byte alignment?
Hi,
You can use attributes with gcc:
__attribute__((aligned))
aligns to natural machine integer boundary
__attribute__((aligned(8)))
aligns to user-specified boundary
__attribute__((packed))
use minimum space
e.g.
struct foo { int x; char y; } __attribute__((aligned));
I prefer __attribute__ over pragma for portability, but otherwise it may
just be a matter of taste.
Fang
_______________________________________________
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