Pointer Provenance in Rust vs. C++: Pointers Are Not Just Glorified Ints
Summary
Pointer provenance is the compiler-tracked origin of a pointer’s allocation, used by LLVM to optimize memory access. The article contrasts C++ and Rust approaches: casting pointers to integers in C++ can expose or erase provenance and hinder optimizations, while Rust provides explicit provenance-aware APIs (addr, with_addr, without_provenance) to express intent and preserve safety. It also uses LLVM IR visuals and discusses practical implications for safe, high-performance code and future tooling (e.g., Miri).