Example:
A validation method contains this check to see if an NSError object shall be created or not:
- (BOOL)validateCompanyName:(NSString *)newName error:(NSError **)outError {
if (outError != NULL) {
// do it...
Now I pass an NSError object, like this:
NSError *error = nil;
BOOL ok = [self validateCompanyName:@"Apple" error:&error];
I’m not sure if this matches the check for not NULL. I think it’s not NULL, since I believe NULL is not nil. Maybe someone can clear this up?
nil(all lower-case) is a null pointer to an Objective-C object.Nil(capitalized) is a null pointer to an Objective-C class.NULL(all caps) is a null pointer to anything else.Yet they all compile to
0, so(nil == Nil == NULL == 0)(thanks Dave).