title: When would I use const volatile, register volatile, static volatile in C++?
body: <p>I am wondering about the different uses of the <strong>volatile</strong> keyword in combination with <strong>register</strong>, <strong>const</strong> and <strong>static</strong> keywords. I am not sure what are the effects, so I think:</p>
  
  <pre><code>register volatile int T=10;
  </code></pre>
  
  <p>Suggest the compiler to store T in a register and the value of T can be modified from somewhere outside (OS, hardware, another thread) </p>
  
  <pre><code>const volatile int T=10;
  </code></pre>
  
  <p>The program itself can not modify T, but T can be modified frow somewhere outside the code.</p>
  
  <pre><code>static volatile int T=10;
  </code></pre>
  
  <p>If T is a data member of a class it means that all the objects of the class have the same value for T and T can be modified from somewhere outside. If T is a global variable in a file, the source code in other files (that are part of the project) cannot access T, but T can be accessed from somewhere outside. If T is a local variable in a function,once it has been initialized remains in the memory until the end of the program and can be modified from somewhere outside.</p>
  
  <p>Are my thoughts correct and can any experienced C++ developer give an example where the above maybe used in real-world applications or it is very rare?</p>