For { A=a; B=b; }, will “A=a” be strictly executed before “B=b”?

后端 未结 6 1875
臣服心动
臣服心动 2020-12-23 19:14

Suppose A, B, a, and b are all variables, and the addresses of A, B, a, and

6条回答
  •  粉色の甜心
    2020-12-23 20:05

    My read is that this is required to work by the C++ standard; however if you're trying to use this for multithreading control, it doesn't work in that context because there is nothing here to guarantee the registers get written to memory in the right order.

    As your edit indicates, you are trying to use it exactly where it will not work.

提交回复
热议问题