2 ms·
Seems like a corner case, no?
by deadmutex 6y ago
Seems like a corner case, no?
- wahern 6y agoIt depends heavily on context. I don't think the benefit of sentinels are only rarely encountered; not in my experience. But if you start out with the assumption that sentinels are always worse than pointer+size tuples, either for performance or ergonomics, then you're less likely to conceive of or recognize solutions where sentinels are better. I tend to agree that occasions when sentinels are the better option are firmly in the minority. Although I'm a little uneasy saying that because it assumes we can construct a singular, meaningful solution space and enumerate occasions where one approach is preferable than the other. IME that's not a very profitable way to approach things. (I want to make a comment about the problematic, fuzzy concept of "string" in computer science and the dynamic of how people conceive of problem and solution spaces in various languages and domains, but that's a rabbit hole I won't be able to climb out of.)