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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to