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: Quincey Morris <email@hidden>
- Date: Fri, 19 Feb 2016 20:59:58 -0800
- Feedback-id: 167118m:167118agrif8a:167118sW6yQNrh1x:SMTPCORP
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. (On Macs that support 32-bit and 64-bit apps, there are two versions of every framework, so this would only be a problem on iOS.)
> 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?
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.
_______________________________________________
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