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.
Some examples from the talk:
- Volatile bit Fields should be specified by your hardware manual and/or compiler.
- Is
+=
a single/atomic instruction? How about ++
?
- How many reads/writes are needed for
compare_exchange
? What if it fails?
- What does
void foo(int volatile n)
mean? or int volatile foo()
- Should
*vp;
do a load? (This has changed twice in the standard.)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…