Pointer comparisons ignore provenance
Pointer comparisons ignore provenance
Posted Oct 19, 2024 19:46 UTC (Sat) by NYKevin (subscriber, #129325)In reply to: Pointer comparisons ignore provenance by NYKevin
Parent article: Zapping pointers out of thin air
NB: This is assuming you're talking about my (1) and (2), and not Tobu's, because that seemed obviously wrong to me. Tobu's (1) requires that casting both pointers to usize and comparing them produces the same result, whereas (2) permits it to non-deterministically return false in cases where the provenance does not match, so (2) allows optimizations that (1) forbids. It is certainly not the case that compilers will prefer to leave optimizations on the table if they are permitted by whatever standard we end up adopting.
