3 ms·
Completely agree with most of that, especially the problem that allowing nulls means that all of your values are now suspect. Just picking up on the term "sent
by mrkeen 2y ago
Completely agree with most of that, especially the problem that allowing nulls means that all of your values are now suspect.
Just picking up on the term "sentinel" here, which I believe refers to using an actual member of the set to represent something else - which I am totally against,
e.g.
int itemCount = countItemsIn() - countItemsOut();
The rationale goes: no-one would ever think -1 is a valid count of items, so we can use it as an error sentinel.
Then when countItemsIn() returns 1 and countItemsOut() fails, we deduce that itemCount is 2.
So I guess a sentinal is a kind of dual to a null (which is a non-member of a set pretending to be a member)