4 ms·
I don't think pointer tagging (in and of itself, when implemented correctly for a particular platform) is ever undefined behavior. Rather, it is implementation-
by wavemode 1y ago
I don't think pointer tagging (in and of itself, when implemented correctly for a particular platform) is ever undefined behavior. Rather, it is implementation-defined behavior - the result of converting a pointer to an integer is not specified, and could in theory be anything, so you have to know how your compiler and platform behave.
- RossBencina 1y agoWe pray that it is implementation defined. According to some [1] even arithmetic on intptr_t is UB, let alone bit operations. [1] https://stackoverflow.com/a/64863331/2013747 https://stackoverflow.com/a/64863331/2013747
- deleted 1y ago[deleted]
- gpderetta 1y agoEh, that's about strictly conforming programs. In practice the vast majority of programs are going to use platform facilities and extensions (POSIX for example) while still being conforming.