• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can an NSArray ever have a count of -1?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 11:43:25 +0700

> On 20 Feb 2016, at 11:24, Quincey Morris <email@hidden> wrote:
>
> On Feb 19, 2016, at 19:00 , Gerriet M. Denkmann <email@hidden> wrote:
>>
>> I use Other C Flags: -DNS_BUILD_32_LIKE_64=1
>
> AFAIK this is a Mac-only thing. I don’t believe it works on a 32-bit iOS platform, in particular because I don’t believe there are any 64-bit system frameworks on such a system. There’d be an ABI mismatch.

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)


>
> Also (I could be wrong but) I don’t think it was ever in the iOS SDK.
>
> The point about Apple’s %ld/(long) recommendation was that it replaced a source code construct that was correct only via knowledge of the architecture it was compiled for, with a construct that was correct for all platforms.

With DNS_BUILD_32_LIKE_64 NSUInteger is long on all platforms, so %lu works in all cases.


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


  • Follow-Ups:
    • Re: Can an NSArray ever have a count of -1?
      • From: Quincey Morris <email@hidden>
References: 
 >Re: Can an NSArray ever have a count of -1? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Can an NSArray ever have a count of -1? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Can an NSArray ever have a count of -1?
  • Next by Date: Re: Can an NSArray ever have a count of -1?
  • Previous by thread: Re: Can an NSArray ever have a count of -1?
  • Next by thread: Re: Can an NSArray ever have a count of -1?
  • Index(es):
    • Date
    • Thread