c++ - Do I have the guarantee that all pointers have the same size in bytes? -
this question has answer here:
in c , c++, have guarantee pointers have same size in bytes, or in other words :
sizeof(void*) = sizeof(char*) = sizeof(int*) = ... or there akward systems on not true ?
no. there no guarantee in standard.
there exception systems. although it's fixed in many typical systems , depends on architecture of system. example in 32-bit systems pointers 4 bytes.
by way, uintptr_t can hold pointers (maybe can assume has maximum size of pointer in current system):
uintptr_tunsigned integer type capable of holding pointer
Comments
Post a Comment