Would a pointer to a pointer to nil match against NULL?

Posted by dontWatchMyProfile on Stack Overflow See other posts from Stack Overflow or by dontWatchMyProfile
Published on 2010-06-13T06:20:52Z Indexed on 2010/06/13 6:22 UTC
Read the original article Hit count: 160

Filed under:

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?

© Stack Overflow or respective owner

Related posts about objective-c