Volatile Pointer to Non Volatile Data
<p>Suppose I have the following declaration:</p>

<pre><code>int* volatile x;
</code></pre>

<p>I believe that this defines a volatile pointer "normal" variable.</p>

<p>To me this could mean one of two things:</p>

<p><strong>First Guess</strong></p>

<p>The pointer can change, but the number will not change without notice.  This means that some other thread (that the compiler doesn't know about) can change the pointer, but if the old pointer was pointing to a "12" then the new pointer (the new value of the pointer, because the thread changes it) would point to another "12".</p>

<p>To me this seems fairly useless, and I would <em>assume</em> that this is not what the real operation is.</p>

<p><strong>Second Guess</strong></p>

<p>The pointer can change, and thus if the pointer changes, the compiler must reload the value in the pointer before using it.  But if it verifies that the pointer did not change (with an added check), it can then assume that the value it points to remained the same also.</p>

<p>So my question is this:</p>

<p>What does declaring a volatile pointer to non volatile data actually do?</p>