logoalt Hacker News

Maxatar • today at 4:14 PM • 1 reply • view on HN

The rules and process are defined here:

https://gcc.gnu.org/onlinedocs/gcc/Arrays-and-pointers-imple...


Replies

cowlevel • today at 4:21 PM

> When casting from pointer to integer and back again, the resulting pointer must reference the same object as the original pointer, otherwise the behavior is undefined.

So I'm right. This is implementation-defined, and the way the implementation has defined it is to make it fully UB (except for round trips).