nil 与 NULL,Nil
- (NSArray*)providers
{
id null = (id)[NSNull null];
return [NSArrayarrayWithObjects:
(self.weekdaysProvider != nil) ? self.weekdaysProvider : null,
(self.daysProvider != nil) ? self.daysProvider : null,
(self.monthsProvider != nil) ? self.monthsProvider : null,
(self.yearsProvider != nil) ? self.yearsProvider : null,
(self.erasProvider != nil) ? self.erasProvider : null,
nil];
}
If someone sees you passing NULL, they know the receiver expects a C pointer. If they see nil, they know the receiver is expecting an object. If they see Nil, they know the receiver is expecting a class. Readability;
区别:一个是 没有开辟空间,一个是 开辟空间了没有住人,