Just trying to figure out what's the best practice: when using method that takes (NSError**)
, is it better to send it nil
or NULL
?
For example,
NSArray *items = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL];
I开发者_如何转开发n the documentation it says "You may specify nil for this parameter if you do not want the error information." On the other hand, since its a double pointer, NULL seems to make sense as well?
Technically, NULL
is the right answer and the docs are wrong.
In practice, it matters not. NULL
and nil
are the same, for all intents and purposes.
While that could change and remain language compliant, it couldn't change without breaking tons and tons of stuff.
Feel free to file a bug, though.
精彩评论