View difference between Paste ID: 2h94JkqN and 4NBWnV6R
SHOW: | | - or go back to the newest paste.
1-
id obj = [[NSObject alloc] init];
1+
- (NSUInteger)retainCount
2-
NSLog(@"retainCount=%d", [obj retainCount]);
2+
{
3
    return NSExtraRefCount(self) + 1;
4-
/*
4+
}
5-
* retainCount=1 будет выведено в консоль
5+
6-
*/
6+
inline NSUInteger
7
NSExtraRefCount(id anObject)
8
{
9
    return (struct obj_layout *)anObject)[-1].retained;
10
}