• 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: Comparing NSDictionary woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing NSDictionary woes


  • Subject: Re: Comparing NSDictionary woes
  • From: mmalc crawford <email@hidden>
  • Date: Sun, 22 Jul 2007 17:02:54 -0700


On Jul 22, 2007, at 4:53 PM, mmalc crawford wrote:

If they are identical in the printout, wouldn't that mean they are equal?

No, exactly as specified by the isEqual: test I referred to in my first reply and as amplified by Chris in his.

To illustrate:


#import <Foundation/Foundation.h>

@interface HelloWorld : NSObject
@end
@implementation HelloWorld
-(NSString *)description { return @"Hello, world."; }
@end


int main (int argc, const char * argv[]) {

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    HelloWorld *world1 = [[[HelloWorld alloc] init] autorelease];
    HelloWorld *world2 = [[[HelloWorld alloc] init] autorelease];

    NSLog(@"world1\n%@", world1);
     NSLog(@"world2\n%@", world2);

     if ([world1 isEqual:world2]) {
          NSLog(@"worlds equal");
    } else {
          NSLog(@"worlds apart");
    }

    [pool drain];
    return 0;
}


mmalc

_______________________________________________

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


References: 
 >Comparing NSDictionary woes (From: Ken Tozier <email@hidden>)
 >Re: Comparing NSDictionary woes (From: mmalc crawford <email@hidden>)
 >Re: Comparing NSDictionary woes (From: Ken Tozier <email@hidden>)
 >Re: Comparing NSDictionary woes (From: mmalc crawford <email@hidden>)
 >Re: Comparing NSDictionary woes (From: Ken Tozier <email@hidden>)
 >Re: Comparing NSDictionary woes (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: Comparing NSDictionary woes
  • Next by Date: Re: Comparing NSDictionary woes
  • Previous by thread: Re: Comparing NSDictionary woes
  • Next by thread: Re: Comparing NSDictionary woes
  • Index(es):
    • Date
    • Thread