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 10:00:47 +0700
> On 20 Feb 2016, at 06:32,Charles Srstka <email@hidden> wrote:
>
>
>
>> On Feb 19, 2016, at 4:29 PM, Jens Alfke <email@hidden> wrote:
>>
>> NSInteger is a typedef of ‘long’ in 64-bit, and ‘int’ in 32-bit.
>> You’re correct that %d should be used for NSInteger in 32-bit.
>
> The recommended way to use an NSInteger, as per Apple documentation, is to use %ld and explicitly cast it to long.
>
> NSLog(@“foo is %ld”, (long)foo);
>
> This will work regardless of platform.
>
> For NSUInteger, you use %lu and cast to unsigned long.
I use Other C Flags: -DNS_BUILD_32_LIKE_64=1
with this:
NSLog(@“array size %lu”, someArray.size )
works fine both for 32 and 64 bit; no warnings or errors.
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