Pointer to NSUInteger
Can I convert a pointer to NSUIntege开发者_JAVA技巧r and reliably compare values to test for object equality?
You would be testing that the pointers refer to the same object. Or in other words, that the pointers are equal.
But you can do that without casting them to NSUInteger.
Why not just compare pointers directly? This code:
NSString *foo = @"Hello,";
NSString *bar = @"World!";
if (foo == bar) {
// Do something.
}
is testing for pointer equality, no conversion needed.
精彩评论