Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • "In practice, volatile doesn't do what you mean". What?? Volatile is designed to prevent compiler optimizations on a variable. It's highly, highly, highly recommended for multithreaded programming. Don't attempt multithreaded programming without volatile. Your program may work fine for years and suddenly crash out of nowhere. Commented Jan 28, 2016 at 14:48
  • @annoying_squid, see stackoverflow.com/a/2485177/136208. Starting from C++ 11, std::atomic<> is probably the way to get what you though volatile would provide. Commented Jan 28, 2016 at 14:55