NULL和nullptr和nil和Nil还有NSNull
NULL和nullptr 在Clang 6.0 的stddef.h文件中可以找到NULL和nullptr的声明: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #undef NULL #ifdef __cplusplus # if !defined(__MINGW32__) && !defined(_MSC_VER) # define NULL __null # else # define NULL 0 # endif #else # define NULL ((void*)0) #endif #ifdef __cplusplus #if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) namespace std { typedef decltype(nullptr) nullptr_t; } using ::std::nullptr_t; #endif #endif 早在1972年,C语言诞生的初期,常数0带有常数及空指针的双重身分。 C使用preprocessor macro NULL表示空指针,让NULL及0分别代表空指针及常数0。 NULL可被定义为((void*)0)或是0。 C++并不采用C的规则,不允许将void*隐式转换为其他类型的指针。为了使代码char*