问题
According to cppreference, most uses of the volatile
keyword are to be deprecated in C++20. What is the disadvantage of volatile
? And what is the alternative solution when not using volatile
?
回答1:
There's a good talk by the c++ committee language evolution chair on why.
Brief summary, many of the places that volatile
is being removed from didn't have any understandable meaning and just caused confusion.
来源:https://stackoverflow.com/questions/59223814/why-is-volatile-deprecated-in-c20