Re: Can an NSArray ever have a count of -1?
Re: Can an NSArray ever have a count of -1?
- Subject: Re: Can an NSArray ever have a count of -1?
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 20 Feb 2016 12:30:39 +0700
> On 20 Feb 2016, at 11:59, Quincey Morris <email@hidden> wrote:
>
> On Feb 19, 2016, at 20:43 , Gerriet M. Denkmann <email@hidden> wrote:
>>
>> This:
>> UIDevice *theDevice = [UIDevice currentDevice];
>> NSLog(@“%s NSUInteger %lu bytes on %@“,__FUNCTION__, sizeof(NSUInteger), theDevice.localizedModel);
>>
>> prints:
>> -[AppDelegate application:didFinishLaunchingWithOptions:] NSUInteger 4 bytes on iPhone (iPone 4s in Simulator)
>> -[AppDelegate application:didFinishLaunchingWithOptions:] NSUInteger 8 bytes on iPad (iPad Air in Simulator)
>
> I’m not sure what that proves. Yes, NSUInteger is different sizes for different iOS architectures. What I said was that if you could force NSUInteger to be 8 bytes instead of 4 bytes on iOS (using NS_BUILD_32_LIKE_64), then the app would crash on an architecture where system frameworks knew NSUInteger to be 4 bytes.
Sorry about being not very clear. One can NOT force NSUInteger to be different sizes. It will always be 4 bytes on 32 bit systems, and 8 bytes on 64 bit ones.
32 bit without DNS_BUILD_32_LIKE_64
NSUInteger = int;
32 bit with DNS_BUILD_32_LIKE_64
NSUInteger = long (but long = int)
64 bit (regardless of DNS_BUILD_32_LIKE_64)
NSUInteger = long (but long > int)
>
>> With DNS_BUILD_32_LIKE_64 NSUInteger is long on all platforms, so %lu works in all cases.
>
> Can you demonstrate NS_BUILD_32_LIKE_64 making NSUInteger 8 bytes for the iPhone 4s?
Sorry, as I said above, this cannot be done.
>
> You also need to be careful about demonstrating architectural claims on a simulator. It’s an iOS simulator, but it’s an OS X platform, which is why you can’t [legally] lipo together simulator and device dylibs into a single framework, to the annoyance of many 3rd-party framework developers.
Without the complication of Simulators:
NSUInteger 4 bytes on “พาย" = iPad 3rd Generation (iPad); iOS 9.2.1
NSUInteger 8 bytes on "โพยม" = iPad Air(Wifi) (iPad); iOS 9.2.1
Kind regards,
Gerriet.
_______________________________________________
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