Re: Problem parsing file in 64 bit build.
Re: Problem parsing file in 64 bit build.
- Subject: Re: Problem parsing file in 64 bit build.
- From: Jens Alfke <email@hidden>
- Date: Mon, 07 May 2012 16:55:13 -0700
On May 7, 2012, at 4:35 PM, Graham Cox wrote:
> The alternative would be to pull out each data field one by one, which I'm sure is also considered acceptable practice, but for this file type, using structs has proved to be a lot easier, not least because of a) the strange mix of big-endian and little-endian values in the same file and b) the presence of directly formatted 'double' values that are not platform independent.
I agree; using structs for this results in the cleanest code.
> Some discussion of the merit of #pragma pack(n) versus other methods would be useful here, it's not something I've had to deal with very much.
Assuming this just needs to support Mac and/or iOS, go ahead and use #pragma pack. If your code really has to be fully cross-platform, then things get dicier because #pragma pack isn’t supported by all compilers.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden