Because it's too easy to not bother checking that, whereas you can't avoid noticing that you got the "sentinel" tube. You might still not bother exhaustively checking the cupboard but that's fine - it just means you order more toothpaste slightly too early rather than slightly too late, which would be much worse.
Still I think this is a stretched analogy. Decent strategy in real life, but programming is not the same and in my experience in-band signalling like this generally leads to fragile code. I mean nobody would recommend null terminated strings as a sane design today...
Still I think this is a stretched analogy. Decent strategy in real life, but programming is not the same and in my experience in-band signalling like this generally leads to fragile code. I mean nobody would recommend null terminated strings as a sane design today...