Objective-C:对于分配给nil的var,NSLog打印(null)?

1 null xcode cocoa objective-c

我很好奇为什么一个变量明显分配给nil,用NSLog打印为(null):

NSString *myVar = nil;
NSLog(@"%@", myVar);

# RESULT: ' (null) '
Run Code Online (Sandbox Code Playgroud)

考虑到在Objective-C中弄清楚所有不同类型的"虚无",并且让我尝试测试各种IF NULL语法,这当然是相当混乱的.

Tho*_*ing 9

总结出不同种类的"虚无":

nil  //Null pointer to an Objective-C object
Nil  //Null pointer to an Objective-C class
NULL  //Null pointer
Run Code Online (Sandbox Code Playgroud)

以上所有都定义为((void *)0).