3 ms·
In particular, you don't need volatile unless you're writing hardware device drivers. If you're doing that, then you also need to understand the semantics of t
by hedora 3y ago
In particular, you don't need volatile unless you're writing hardware device drivers. If you're doing that, then you also need to understand the semantics of the memory mappings of the I/O pages you're writing. You also need to know about bus ordering and request coalescing guarantees for PCIe (or AXI, or whatever your embedded system uses).
If that paragraph doesn't make any sense, and you think you need volatile then there are basically two possibilities: You're writing a Java program (which uses that keyword for something else), or you need std::atomic (or __sync_* for C) instead.
- gpderetta 3y ago> (or __sync_* for C) Actually even C has _Atomic these days!