If object is of type id
or any valid Objective-C object, then only one difference is present: readability. (i. e. from the compiler's point of view, they're both the same.)
However, there may be examples when comparing to nil
wouldn't be very nice. For example, if for some evil illogocal reason, object was an int
, only the two following statements would be valid:
if (object == 0)
and
if (!object)
and they would again be equivalent, but comparing an int to a pointer (which nil
is) - except if the integer is an explicit constant 0 - is illegal and most likely result in a compiler warning (in most cases, it would still work, however...)