May volatile be in user defined types to help writing thread-safe code

前端 未结 8 2218
别那么骄傲
别那么骄傲 2020-12-04 18:19

I know, it has been made quite clear in a couple of questions/answers before, that volatile is related to the visible state of the c++ memory model and not to m

8条回答
  •  再見小時候
    2020-12-04 19:14

    I don't know specifically whether Alexandrescu's advice is sound, but, for all that I respect him as a super-smart dude, his treatment of volatile's semantics suggests that he's stepped way outside his area of expertise. Volatile has absolutely no value in multithreading (see here for a good treatment of the subject) and so Alexandrescu's claim that volatile is useful for multithreaded access leads me to seriously wonder how much faith I can place in the rest of his article.

提交回复
热议问题