3 ms·
size_t only has to be large enough to accommodate the size of the largest object possible in a given implementation. It has no relation to pointers at all. Sim
by int_19h 8y ago
size_t only has to be large enough to accommodate the size of the largest object possible in a given implementation. It has no relation to pointers at all.
Similarly, ptrdiff_t only has to be large enough to accommodate the difference between two pointers where such difference is legal ("when two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object").
Hence the need for intptr_t and uintptr_t, and why they're optional unlike size_t and ptrdiff_t.