• 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: -[NSSet containsObject:] returns NO when it should return YES
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -[NSSet containsObject:] returns NO when it should return YES


  • Subject: Re: -[NSSet containsObject:] returns NO when it should return YES
  • From: Michael Crawford <email@hidden>
  • Date: Sat, 19 Feb 2011 22:01:09 -0500

On Feb 19, 2011, at 9:31 PM, Ken Thomases wrote:

> On Feb 19, 2011, at 4:17 PM, Michael Crawford wrote:
>
>> I also assumed that whether or not the value is signed or unsigned; negative or positive makes no difference as long as calling the same accessor method on both NSNumber instances returns the same result.
>
> I think this is wrong.  I can't imagine why you assumed that some future method call would affect whether two NSNumbers are equal.  They are equal if they contain the same value.  You must realize that, for example, -boolValue would map a great many different NSNumbers to the same return value, but that doesn't imply that the NSNumbers are equal.
>
> Regards,
> Ken
>

I assumed this is the case because regardless of whether or not you call -boolValue or -longLongValue, -hash returns the same result.  I've already shown that they do indeed contain the same value, when -longLongValue is called on both items.  See the dbg output.

-Michael
_______________________________________________

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: -[NSSet containsObject:] returns NO when it should return YES
      • From: Ken Thomases <email@hidden>
    • Re: -[NSSet containsObject:] returns NO when it should return YES
      • From: Kyle Sluder <email@hidden>
References: 
 >-[NSSet containsObject:] returns NO when it should return YES (From: Michael Crawford <email@hidden>)
 >Re: -[NSSet containsObject:] returns NO when it should return YES (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: -[NSSet containsObject:] returns NO when it should return YES
  • Next by Date: Re: -[NSSet containsObject:] returns NO when it should return YES
  • Previous by thread: Re: -[NSSet containsObject:] returns NO when it should return YES
  • Next by thread: Re: -[NSSet containsObject:] returns NO when it should return YES
  • Index(es):
    • Date
    • Thread