Objc 中 nil Nil NULL NSNull 之间的区别

nil

#ifndef nil
     #define nil __DARWIN_NULL    /* id of Nil instance */
#endif

Nil

#ifndef Nil
     #define Nil __DARWIN_NULL    /* id of Nil class */
#endif

NULL

#ifndef NULL
    #define NULL    __DARWIN_NULL
#endif /* ! NULL */

NSNull

NSNull is a class defines a singleton object used to represent null values in collection objects (which don’t allow nil values).

[NSNull null]: The singleton instance of NSNull.
#import <Foundation/NSObject.h>
@interface NSNull : NSObject <NSCopying, NSCoding>
   + (NSNull *)null;
@end