Determining value of NSUInteger
I'd like to view the value of an NSUInteger at any given time. I assign the value below:
NSUInteger test = -1;
Then try to view it in the debugger:
(gdb) po test
Cannot access memory at address 0xffffffff
(gdb) p test
$1 = 4294967295
Current language: auto; currently objective-c
Fa开发者_运维知识库r as I know, it is a value type. Where is -1?
You're using an NSUInteger
, which is unsigned. As such, any negative values assigned will actually be interpreted very large positive values.
You want to use NSInteger
which is signed (and therefore can be both positive and negative values). You should then be able to do (gdb) p test
to see the value.
精彩评论