In the Pragmatic Core Data book, I came across this code snippet for an NSString
setter:
- (void)setMyString:(NSString*)string;
{
@synchronized(self) {
if ([string isEqualToString:myString]) return;
[myString release];
myString = [string retain];
}
}
Is there any reason to use [string isEqualToString:myString]
instead of string == myString
here? Does it not mean that if the two strings have the same content, the result will be different than if they are actually the same object? Does this matter?
Thanks.