Comment by pjmlp
2 years ago
It is how many languages implement strings without being bound by numeric limits.
Naturally for this to work out without bugs, it cannot be exposed directly, only manipulated via a string library.
2 years ago
It is how many languages implement strings without being bound by numeric limits.
Naturally for this to work out without bugs, it cannot be exposed directly, only manipulated via a string library.
size_t is large enough to hold the size of the largest possible object in memory. In practice, on most architectures, that means it is the same size as pointers. I'm not sure if there is a case where start + end pointer can describe a valid string in memory that start pointer + size couldn't? If that was the case, that string wouldn't be an "object" by definition.