Like the title says - is there any case in which volatile
is useful in the context of singlethreaded programming? I know it's used to make sure the value of the variable is always actually checked in memory so is there any case in which that value may change (in a ST app) in a way that the app/compiler won't notice?
I'm leaving this question language-agnostic as I'm not aware of any differences between them that would affect the answer to this question. But if there are any please let me know.
Edit: As it's been pointed out to me, the question isn't language-agnostic. I'm making it C++ specific then (I've read that there are differences in C++ versions as well but I hope they aren't big enough to make this question too broad).