I have a pointer. On a 32-bit system, this is 32 bits. On a 64-bit system, this is 64 bits.
I have a long integer field used as an identifier, and sometimes I want to use a pointer value here. (I never go back to a pointer - as soon as I pass it to an integer field, I only ever compare it for equality).
For both 32-bit and 64-bit systems, this is safe. (In larger switch systems, not so). It's true?
And then is there a way to make GCC not give the following warning only when building on platforms where it is safe (that is, at the moment, all target platforms)?
error: casting to a pointer from an integer of different sizes [-Werror = int-to-pointer-cast]
Ben clifford
source share