I need to represent pointers as strings to the user. Sometimes the values might be saved to a file and transferred to a computer with different architecture (32 vs 64 bit is the main issue currently) and loaded from text file to be compared - I'm only going to compare loaded values with each other, but I'd still prefer to compare numbers than strings.
I'm currently using:
SomeClass* p;
...
printf("%ld", (uintptr_t)p);
but I wonder if this is portable (Windows and Linux are only important at this stage though), and whether this would break once 128-bit systems show up?
Edit: unless I decide to use uint64_t, and decide that 64bit is the rooftop, this cannot be done because some 64bit pointer might be outside 32bit integer range. So, I decided that it would be safer to compare strings even if it's slower.