Both the following comparisons evaluate to true:
1)
@\"foo\" == @\"foo\";
2)
NSString *myString1 = @\"foo\";
NSStri
==
compares locations in memory. ptr == ptr2
if they both point to the same memory location. This happens to work with string constants because the compiler happens to use one actual string for identical string constants. It won't work if you have variables with the same contents, because they'll point to different memory locations; use isEqualToString
in such a case.