3 ms·
To quote the article: > This is a bit different than the other examples, as there are no pointers or references. But the idea of a value that is not a value is
by paulddraper 11y ago
To quote the article:
> This is a bit different than the other examples, as there are no pointers or references. But the idea of a value that is not a value is still present, in the form of a char that is not a char.
It has nothing to do with the similarity in name (NULL / NUL). As you said, it could be terminated with $. The similarity is that they are both sentinel values. NULL is a sentinel for types; NUL is a sentinel for char arrays.
In both cases, they create exceptional and non-composable situations.
Good explanation here: https://www.reddit.com/r/programming/comments/3j4pyd/the_worst_mistake_of_computer_science/cumbius https://www.reddit.com/r/programming/comments/3j4pyd/the_wor...
- ursus_bonum 11y agoI know the author claims that there's a meaningful similarity beyond the names. But that's where I disagree. I get that a NULL pointer is in some meaningful way not a pointer. Because it literally isn't pointing to anything. It is not the case that NUL is a char that is not a char. NUL is a perfectly good char. Some functions treat it specially, but other than that it's just a regular char. Even the sentinels similarity is quite weak. NULL is a sentinel that indicates "no valid object" whereas NUL is a sentinel that indicates the end of a perfectly valid object. Notice how we're not having this discussion about '\n' or the whitespace chars in general, even though they're also treated as sentinels by some functions.