Talk:cpp/types/ptrdiff t
Article change proposition (I'm not sure if it's correct, so, I will post it here for discussion instead of applying it myself):
The sentence:
"If an array is so large (greater than PTRDIFF_MAX elements, but less than SIZE_MAX bytes), that the difference between two pointers may not be representable as std::ptrdiff_t, the result of subtracting two such pointers is undefined."
Should it be:
If an array is so large (greater than PTRDIFF_MAX bytes, but less than SIZE_MAX bytes) ...
ptrdiff_t serves to keep result of subtracting a pointer from another one. The range of possible values resulting from such an operation depend on the length of the array in question, expressed in 'bytes'(char-s), not upon the length expressed in 'elements'. Thus, changing respective text to "greater than PTRDIFF_MAX bytes" would make overall statement correct. As for "but less than SIZE_MAX bytes" part, it points to the fact that no valid object is greater in size than SIZE_MAX bytes, so it seems correct if somewhat unnecessary. I'm not sure if I a'v been missing something out.
Cpprf acount (talk) 11:54, 3 November 2017 (PDT)