C ++ pointer comparison size
the Object Pointer value is an integer mapped to a linear address space, c/C ++ allows comparison between two object pointers of the same type, including = ,! =, <,>, <=,> =. Therefore, the answer to the LZ question is yes. For different types of object pointers, the conversion can be compared. Because the static type check of C ++ is stricter than that of C, the same Code may cause compilation errors in the C ++ compiler, while the C compiler generates warnings only due to the lack of implicit conversions. The member pointer of C ++ is generally implemented by offset, but it does not necessarily indicate the specific address or offset (it can be regarded as an invisible struct of a member, and is related to the compiler and the type to which it points; even the sizeof results of different member pointer types on the same compiler are not unique. In this case, the conversion by value cannot be implemented and cannot be compared ), converting to an integer is meaningless. Different Member pointers of different types cannot be compared; operator ==and operator cannot be performed for member pointers of identical types! = Other (arithmetic) Comparison operations. -- 1. the pointer is the memory address. Error. For example, it may indicate the Register address space. 2. the pointer is a 32-bit integer. An error occurs. For example, the pointer value on a 16-bit platform is a 16-bit unsigned integer, And the pointer value on a 64-bit platform is a 64-bit unsigned integer. In addition, the common error is that in C/C ++, the pointer has a type, the address is an integer, and there is no type (in fact, the address is not a concept that should be involved in the language itself ). A pointer can be an object, and the address itself is only a right value.