const volatile
objects necessary in C++?Note: I do understand the need for pointers to const volatile
memory locations, but those don't require the objects themselves to be const
or volatile
.
I'm asking about objects that are themselves of some const volatile
type, for example:
const volatile T obj;
In which situations are these necessary or useful?
The situations are rare where when you actually need volatile
in c++. volatile
is not useful for multithreaded any more. From this website there are only three portable uses of volatile.
Hans Boehm points out that there are only three portable uses for volatile. I'll summarize them here:
So basically you want to really only use other features for concurrent programming and save volatile for those rare situations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With