I think there is a good argument for suggesting that a conformant C implementation cannot allow an array to end at (e.g.) 0xFFFFFFFF.
Let p
be a pointer to one-element-off-the-end-of-the-array: if buffer
is declared as char buffer[BUFFSIZE]
, then p = buffer+BUFFSIZE
, or p = &buffer[BUFFSIZE]
. (The latter means the same thing, and its validity was made explicit in the C99 standard document.)
We then expect the ordinary rules of pointer comparison to work, since the initialization of p
was an ordinary bit of pointer arithmetic. (You cannot compare arbitrary pointers in standard C, but you can compare them if they are both based in a single array, memory buffer, or struct.) But if buffer
ended at 0xFFFFFFFF, then p
would be 0x00000000, and we would have the unlikely situation that p < buffer
!
This would break a lot of existing code which assumes that, in valid pointer arithmetic done relative to an array base, the intuitive address-ordering property holds.