开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜