News for hackers. Stuff that matters.
Re:nil, Nil, NULL, NSNull by shock-value on Monday January 07, 2013 @02:20PM (#5022637)
Definitely spot on regarding 0 not representing 'nothing'.

However, 'int *' is inherently "pointer to int or nothing" (in the same style as your NSString example), so I'm not sure I agree with your assertion that some types are option types while some aren't in C. Any type can be an option type (in your sense of the term, again a la your NSString example) by making it into a pointer.

Similarly, using an NSString without a pointer (which might not be possible in ObjC, but definitely possible for regular C/C++ objects) makes it not optional, like the 'int'.

Re:nil, Nil, NULL, NSNull by jerf on Monday January 07, 2013 @02:44PM (#5022777)
int and pointer to int are two different types. Pointer-to-int being an option type does not make int an option type. So there are still option types and non-option types.

(Using the prevailing terminology. I'm not sure I'm comfortable with this use of the term "option type", but I'm rolling with it for now.)

Re:nil, Nil, NULL, NSNull by mikeash on Monday January 07, 2013 @02:51PM (#5022820)
Precisely. It's not the case that "any type can be an option type" as shock-value stated. Rather, in C, all pointer types are option types whether you want them to be or not, and all other types are not.