Here is the introduction for size_t
in cppref
std::size_t
can store the maximum size of a theoretically possible object of any type (including array).
I know the exact value is platform-dependent. But who decides the size of theoretically possible object
, the compiler or the operating system, or even the computer manufacturer? Could the size of theoretically possible object be calculated or it's just decided by man-made rule?
In addition, if the machine is 64-bit, does that mean the max object size could be 2^64 bytes?
But who decides the size of theoretically possible object [...] ?
The author of the "implementation" gets to decide. The implementation is a rather nebulous term that includes the compiler, run-time library, and often at least part of the OS.
In addition, if the machine is 64-bit, does that mean the max object size could be 2^64 bytes?
Not really. You probably can't exceed 264-1 bytes, but the limit may well be (normally will be, at least on machine current as of 2018 when I'm writing this) much lower than that. Many current CPUs have much smaller real limits--around 242-1 is probably more realistic.