Remix.run Logo
wavemode 2 days 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 2 days ago | parent [-]

We 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

2 days ago | parent | next [-]
[deleted]
gpderetta a day ago | parent | prev [-]

Eh, 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.