Re: NSNotFound signed???
Re: NSNotFound signed???
- Subject: Re: NSNotFound signed???
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 12 Jun 2013 11:31:01 +0200
Le 12 juin 2013 à 10:14, Oleg Krupnov <email@hidden> a écrit :
>> there isn't enough address space to create a NSArray containing even NSIntegerMax pointers.
>
> I knew someone will say this. Who needs more than 640 KB RAM after
> all? :) © Bill Gates
>
This has nothing to do with the amount of available RAM. The limitation is with the virtual memory system.
If you can have 2^64 bytes of address space, you can a max store "2^64 / sizeof(void *)" pointers.
> What if I have sparse array etc.
If you have sparse array, so just don't write it using NSNotFound. We are talking about a well defined class and well defined API, not a potential non existing API that can use the wrong constant.
> One higher bit is actually twice as many elements. Why having
> NSUInteger at all if you can't use more than NSIntegerMax? This
> doesn't seem right.
Because you want to use an unsigned number to defined the number of element (having a negative number of elements does not make sense), and it is pointless and inefficient to to defined and used a 56bit integer type on actual architectures.
-- Jean-Daniel
_______________________________________________
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