Hi, I am writing a safe pointer object by checking that the pointer is not corrupted before I dereferencing it. I am using the one's complement technique (store a one's complement copy and compare it will the pointer). How do I perform a one's complement on a pointer value? Using ~ on a pointer is invalid (compile complains). I can cast it but I don't think there is any standard on the size of a pointer (so I can't just cast it to integer).
Is there anyway to do it properly or any other ideas? Thanks.