So there 's NULL
, which is used for pointers in general, and nil
, which is used for object pointers.
Now I see there's also Nil
, which is used by lower-level Obj-C runtime functions like class_getProperty
.
Is this somehow different from nil
philosophically? (yes, I know they're all actually 0)
Why was it even introduced? Or, if Nil
was first (which is likely), why was nil
introduced?
Googling "Nil vs nil" found this post http://numbergrinder.com/node/49, which states:
All three of these values represent null, or zero pointer, values. The difference is that while NULL represents zero for any pointer, nil is specific to objects (e.g., id) and Nil is specific to class pointers. It should be considered a best practice of sorts to use the right null object in the right circumstance for documentation purposes, even though there is nothing stopping someone from mixing and matching as they go along.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With