3 ms·
That’s undefined behavior in C though: https://news.ycombinator.com/item?id=3928788 https://news.ycombinator.com/item?id=3928788
by layer8 6y ago
That’s undefined behavior in C though:
https://news.ycombinator.com/item?id=3928788 https://news.ycombinator.com/item?id=3928788
- loeg 6y agoYour linked comment only quotes excerpts saying it's implementation-defined, rather than undefined. Can you point to the part that is undefined? (You would use a uintptr_t for the xor'd prev-next pointers instead of void*.)
- layer8 6y agoTo be precise, it's implementation-defined whether it's undefined behavior, prior to C11. You are right that in C11, if uintptr_t is used to store the xored value, behavior is defined.
- loeg 6y agoImplementation-defined whether it's UB or not is still implementation-defined, I think. Which change are you thinking of in C11? (I'm just curious.) Thanks!