Objective-C nil / Nil / NULL / NSNull 和 BOOL / bool / Boolean / NSCFBoolean

Objective-C nil / Nil / NULL / NSNull 和 BOOL / bool / Boolean / NSCFBoolean

nil / Nil / NULL / NSNull
标志 含义
nil id(0) Objective-C 对象的字面零值
Nil Class(0) Objective-C 类的字面零值
NULL void(0) C指针的字面零值
NSNull [NSNull null] 零值得单独对象(有作没有),区别于Nil
BOOL / bool / Boolean / NSCFBoolean
名字 类型 真值 假值
BOOL signed char YES NO
bool _Bool(int) true false
Boolean unsigned char TRUE FALSE
NSNumber __NSCFBoolean @(YES) @(NO)
CFBooleanRef struct kCFBooleanTrue kCFBooleanFalse

你可能感兴趣的:(Objective-C nil / Nil / NULL / NSNull 和 BOOL / bool / Boolean / NSCFBoolean)