Message from C, C++ talks

June 2019

— Https://www.geeksforgeeks.org/understanding-volatile-qualifier-in-c/amp/

— Http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.kui0097a/armcc_cjaegdea.htm

— I'm still flipping out, 53% said yes

— Whatever

— 

About volatile, just yesterday seen this video.
https://www.youtube.com/watch?v=lkgszkPnV8g
Guys in Facebook made a check on some continuous integration machine that comments a paragraph about "volatile doesn't make your code thread-safe" into the code review, when it finds volatile going to be submitted not in a comment.

— Volatile Is for other purposes

— Yes, but I for a long time thought that volatile bool can be used as a synchronization primitive. Before someone told me why it's not.
And there recently was a local conference in my city related to multithreading, and there were such code with volatile bool, and I've been told that there was a question from the audience and a long discussion, and it turned out that many of those who come to the conference thought it's an ok practice.

Message permanent page

— Why the fuck do people even THINK that volatile assures thread saftey?

— "this is bool, how can it be not thread safe to set it in one thread and read from another. It can't be half-true, can it?"
That were my thoughts. I had no idea about instructions rearrangement and other more rare and complicated stuff.

Message permanent page

— Lol

— Ah and also I heard that VS make volatile bool atomic by default. So it can work sometimes. But not sure if that true or rumors

Message permanent page

— That's true, but there is no justification to deprecate volatile, and it's still needed in other cases like interrupts

Message permanent page

— I never used it for that for example

— Check this out

— Https://docs.microsoft.com/en-us/cpp/cpp/volatile-cpp?view=vs-2019