Re: type of NSNotFound
Re: type of NSNotFound
- Subject: Re: type of NSNotFound
- From: Uli Kusterer <email@hidden>
- Date: Sun, 21 Jul 2013 00:27:01 +0200
On Jul 21, 2013, at 0:06, Matt Neuburg <email@hidden> wrote:
> Isn't there a type mismatch here? It seems to me that NSNotFound ought to be a value *outside* the possible range NSArray index values - which it would be, if NSNotFound were NSUIntegerMax, or if NSArray's indexes were of type NSInteger. As thing are, when you call indexOfObject: and test the result against NSNotFound, you could be getting the wrong answer; if that index happens to be NSIntegerMax (which is only halfway through the available unsigned indexes), it will seem to be NSNotFound when in fact it is an actual index.
It doesn’t matter. An array holds object pointers, so you can only have 1/4th (or 1/8th in 64 bit) of the number of items of available address space to begin with (otherwise, where’d you store the pointers). Or rather, less than that, because of system libraries and the NSArray object itself and your application’s code and ...
This way, NSNotFound works both for NSInteger and NSUInteger and is the same value, and you don’t need an additional NSUNotFound.
Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de
_______________________________________________
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