top | item 44353986

(no title)

DasIch | 8 months ago

C before C11 has no memory model. Rust doesn't have one but effectively it inherits the C++/C memory model, so there is actually no difference.

discuss

order

ynik|8 months ago

That applies only if you take "memory model" to mean modeling the effects of concurrent accesses in multithreaded programs.

But the term could also be used more generally to include stuff like pointer provenance, Rust's "stacked borrows" etc. In that case, Rust is more complicated than C-as-specified. But C-in-reality is much more complicated, e.g. see https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2263.htm

tialaramex|8 months ago

The model you're referring to, a Memory Ordering Model, is literally the same model as Rust's. The "exception" is an ordering nobody knows how to implement which Rust just doesn't pretend to offer - a distinction which makes no difference.