←back to thread

The provenance memory model for C

(gustedt.wordpress.com)
224 points HexDecOctBin | 1 comments | | HN request time: 0.235s | source
Show context
Measter ◴[] No.44433373[source]
In the section about the ambiguous provenance from synthesising pointers, it's explained that the compiler will infer the correct provenance from usage. Would it not be worth having some way for the programmer to inform the compiler directly, with something analogous to Rust's Strict Provenance ptr::with_addr?

To convert it to C syntax, it's a function with roughly this signature:

    void* with_addr(void* ptr, uintptr_t addr)
Where the returned pointer has the address of `addr` and the provenance of `ptr`.
replies(3): >>44434377 #>>44435332 #>>44438710 #