There was a question here about equality of sizeof(size_t)
and sizeof(void*)
and the accepted answer was that they are not guaranteed to be equal.
But at least, must it be that:
sizeof(void*) >= sizeof(size_t)
I think so. Because, take the largest stored object possible in a given C implementation, of size S
. Now, the storage area can be thought of as array of bytes of size S
. Therefore, there must be a pointer to each byte, and all these pointers are comparable and different. Therefore, the number of distinct elements of type void*
, must be at least, the largest number of type size_t
, which is unsigned integer type. Thus sizeof(void*) >= sizeof(size_t)
.
Is my reasoning making sense or not?