Re: 32 -> 64 bit serializations, NSNumber, int, NSInteger
Re: 32 -> 64 bit serializations, NSNumber, int, NSInteger
- Subject: Re: 32 -> 64 bit serializations, NSNumber, int, NSInteger
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 19 Jul 2011 13:32:51 -0600
On Jul 19, 2011, at 12:24 PM, Philip Dow wrote:
> Related to a previous posting of mine regarding floats and CGFloats when decoding older 32 bit serializations in a 64 bit runtime, I am now also in the process of modernizing some old code that used int values encapsulated by NSNumber in keyed archives.
>
> The current serializations were performed in a 32 bit environment. I am now running in a 64 bit environment and am reading those archives. The archives contain NSNumber objects which stored int values. I would like to update the code to use NSInteger instead and the corresponding methods on the NSNumber objects.
>
> Will I run into a similar decoding problem where the int values will not be correctly read as longs in the new environment, or is NSNumber taking care of things under the hood for me?
You won't know until you try, but with keyed archives and NSNumber, you should not run into any problems across architectures, because NSNumber's accessors will do conversions as necessary. The only problem I ever had with unarchiving 32-bit app archives in a 64-bit app was with longs in non-keyed archives that were encoded using @encode(long)*, and that doesn't apply to your scenario.
Nick Zitzmann
<http://www.chronosnet.com/>
* The reason was because the value of @encode(long) changed from "l" in 32-bit code to "q" in 64-bit code, which is understandable.
_______________________________________________
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