Beingessner: Rust's Unsafe Pointer Types Need An Overhaul
Beingessner: Rust's Unsafe Pointer Types Need An Overhaul
Posted Apr 4, 2022 2:54 UTC (Mon) by ncm (guest, #165)In reply to: Beingessner: Rust's Unsafe Pointer Types Need An Overhaul by jlombera
Parent article: Beingessner: Rust's Unsafe Pointer Types Need An Overhaul
Unless you are pinging hardware registers, "volatile" is doing absolutely nothing for you, no matter how it looks to you in Godbolt. To synchronize between threads, you need memory fences, which are expressed as "atomic" types in C and C++. If you are using atomics, there is exactly zero value in adding "volatile". If you are not using atomics and not pinging hardware registers, there is exactly zero value in adding "volatile". "Volatile" appearing in code not part of an OS driver reliably indicates bugs.
