Re: EXC_BAD_ACCESS in NSData
Re: EXC_BAD_ACCESS in NSData
- Subject: Re: EXC_BAD_ACCESS in NSData
- From: Uli Kusterer <email@hidden>
- Date: Wed, 28 May 2014 21:24:01 -0700
On 26 May 2014, at 20:28, Charles Srstka <email@hidden> wrote:
> On May 26, 2014, at 7:43 PM, Uli Kusterer <email@hidden> wrote:
>> Regarding endian-swapping, that depends on the file format. If you wrote that file yourself, you don’t usually need to do any swapping.
>
> That's true. For example, back in the PowerPC days, we never had to endian-swap our file formats, because we knew that our file format was created on a Mac, and Macs always used big-endian, and it wasn't as if Apple was ever going to do anything crazy like switch to Intel or anything.
Or change struct alignment or the size of ints or … I’ve been programming for a couple of days, I’ve taken this into account. But I’d rather retroactively go and fix something (you have to re-test when porting to a new platform anyway) than go all architecture astronaut and prepare for changes in ABI that may or may never happen. In a well-architected code-base, the code that is affected by endian-ness is separate from the other code anyway.
Also, endian-ness did not change in the switch from 680x0 to PowerPC for instance, so in my book that was just a fluke. :-p
That said, if you want to be really endian-safe, use an XML file format saved as UTF-8 like Property Lists. Most portable format there is. :-)
Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de
_______________________________________________
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