title: Why mark function argument as volatile
body: <p>I am currently reading the <a href="https://github.com/postgres/postgres" rel="nofollow noreferrer">PostgreSql</a> code. Here is an excerpt from the buffer manager:</p>
  <pre><code>static void WaitIO(volatile BufferDesc *buf);
  static bool StartBufferIO(volatile BufferDesc *buf, bool forInput);
  static void TerminateBufferIO(volatile BufferDesc *buf, bool clear_dirty,
  </code></pre>
  <p>I know the volatile keyword is usually used for device drivers and in embedded systems. There is an explanation of the keyword.</p>
  <blockquote>
  <p>When the keyword volatile is used in the type definition it is giving an indication to the compiler on how it should handle the variable. Primarily it is telling the compiler that the value of the variable may change at any time as a result of actions external to the program or current line of execution.
  (<a href="https://web.archive.org/web/20140329054504/http://www.cognitus.net:80/html/tutorial/usingVolatile.html" rel="nofollow noreferrer">Source</a>)</p>
  </blockquote>
  <p>So why are certain function arguments declared as volatile? I don't expect that DMA changes the pointer location. So what happens here?</p>