NSNull
last edited April 4, 2010 16:26:12 (189.190.248.143)
| |
|---|---|
| Edit / History / New / Search | Quick Links: Home / Recent Changes / Glossary / Jobs / Forums / Help |
|
NSNull is the FoundationKit's equivalent of nil and NULL. It's used as a placeholder in collections which do not allow you to set an item to nil. See also: FoundationCollections
Nothing is a concept that goes by many names:
As you can see, it's a master of disguise. Handle with care. Don't forget the most ancient of all...
--Anonymous Guy If you're talking types, you can also add void. -- RobRix ... And false ... And none -- which coincidentally seems to be the point of this page... and [ ] (imagine nothing in the preceding box.) Correcting Anonymous Guy, it's /dev/null not /dev/null/ (which would be a directory)
The difference of course is that they're not all semantically equivalent. NULL is defined to be a 0x00 byte, while nil is any invalid object pointer which might or might not equall NULL depending on the implementation. This rooted in the fact that it is convention to denote False with zero and True with one, a completely arbitrary choice. It's somewhat misleading because False does no inherently mean Nothing, but they've become somewhat linked due to notational convention. --OwenAnderson
It's not clear exactly what is meant here by "nil is any invalid object pointer" --
And NULL is not "defined to be a 0x00 byte." It's defined to be an alias for the null pointer, which while equivalent to 0 on most architectures, is not portably so. Not to mention that it's pointer-width, not byte-width.
As for the --MarCocoa
As we probably all agree, it is utterly unimportant and purely theoretical, but as said, the Objective-C Language Reference by Apple states that
And converting the integer zero to a pointer type gets you, guess what, | |
| Edit / History / New / Search | Quick Links: Home / Recent Changes / Glossary / Jobs / Forums / Help |