c++ - Do I have the guarantee that all pointers have the same size in bytes? -


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_t unsigned integer type capable of holding pointer


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -