1

Ok so I have several questions about NSNotFound:

  1. How come NSNotFound is defined as NSIntegerMax?

  2. How come apple uses signed instead of unsigned? Wouldn't it be smarter or better yet more logically convenient to use unsigned since the method it relates to if not found return a unsigned value neither-less.

  3. Why is there a possibility for it to return either -1 or NSIntegerMax?

rptwsthi
  • 10,094
  • 10
  • 68
  • 109
  • `NSNotFound` is used by a lot of methods across the Foundation and other frameworks, so 2 and 3 don't seem very relevant. What method are you referring to exactly ? As for 1, what is you proposed solution (keep in mind that `NSNotFound` can be used by methods that return an `NSInteger` or an `NSUInteger`). – deadbeef Oct 24 '15 at 15:37
  • We can only speculate about the reasons, you would have to ask Apple. It might have historical reasons. See http://stackoverflow.com/questions/13585220/why-is-the-row-property-of-nsindexpath-a-signed-integer for a (remotely) similar question. – Your question #3 is unclear to me. – Martin R Oct 24 '15 at 16:02
  • @MartinR http://stackoverflow.com/questions/9338295/why-nsnotfound-isnt-1-but-nsintegermax – Humzaa Choudryy Oct 24 '15 at 20:05

0 Answers0