3 ms·
intptr_t is special though. intptr_t has the property that any void pointer can be converted to it and back again to produce the original value. This is in the
by hvdijk 7y ago
intptr_t is special though. intptr_t has the property that any void pointer can be converted to it and back again to produce the original value. This is in the specification for intptr_t (7.20.1.4), not the general language rules, so it is easy to miss. (Edit: GP used an int pointer, but the example can be trivially modified.)
- giomasce 7y agoAlso, I believe that you can also access the object representation of the pointer and scramble it. If you fix it up later, I believe it will have to represent the original pointer, by C11 6.2.6.1 (4).