What's the difference of the usage of volatile between C/C++ and C#/Java?

后端 未结 3 525
盖世英雄少女心
盖世英雄少女心 2020-12-23 18:10

I found it in many references which mention that volatile in C/C++ is is weak and may cause issue in concurrent environment on multiple processor, but it (

3条回答
  •  粉色の甜心
    2020-12-23 18:34

    In C/C++, volatile has no particular semantics that relate to multithreading, so what behavior it will have in that context is platform-specific. C# and Java provide specific multithreading semantics for volatile. So you know what you're getting and can rely on it.

提交回复
热议问题