4 ms·
The volatile modified on a pointer tells the compiler that reads and writes to it can have side-effects -- it is meant for memory-mapped hardware registers. Bec
by Ded7xSEoPKYNsDd 8y ago
The volatile modified on a pointer tells the compiler that reads and writes to it can have side-effects -- it is meant for memory-mapped hardware registers. Because of those (presumed) side-effects, reads and writes to that volatile pointer cannot be optimized away by dead code elimination.
Changing the address where such a variable points to, will still be optimized away when it isn't used later on.