The eternal question: (start, size) vs (start, end) I think (start, end) is winning
14
50
Is the end inclusive?
2
8
Are you joking with me?
1
5
Yeah, that’s the problem :(
1
1
To be clear, the end is never inclusive. That makes absolutely no sense.
3
1
Unless you want to include the very last byte of memory space while keeping the start<=end invariant.
1
1
I'm moderately sure the C/C++ spec language, by requiring that a pointer one past the final element of an array (or a single-object allocation treatable as a single-element array) compare greater than pointers to array elements, forbids this possibility.
1
1
Ooh, good point, thanks. What a waste of memory! 😆
1
Somehow this discussion reminds me of hg.mozilla.org/mozilla-centr… and the fact that a harmless read past the end of array can crash if the end of the array happens to line up with a page boundary (in this case, all crash addresses ended in 00000).

May 22, 2021 · 4:47 AM UTC

2
2
That in turn reminds me of youtube.com/watch?v=kPR8h4… where some Facebook code would fail under similar circumstances, if a string's contents were allocated up against a page boundary. (Or at least I'm fairly sure that was the video - didn't ratchet the whole thing to be certain.)