title: What does—or did—"volatile void function( ... )" do?
body: <p>I've seen <a href="https://stackoverflow.com/questions/7643528/how-many-usage-does-volatile-keyword-have-in-c-function-from-grammar-perspe">How many usage does &quot;volatile&quot; keyword have in C++ function, from grammar perspective?</a> about use of the volatile keyword on functions, but there was no clear explanation of what Case 1 from that question did.  Only a statement by one of the respondents that it seemed pointless/useless.</p>
  
  <p>Yet I cannot quite accept that statement, since the AES software implementations for GNUC have been used for literally years, and they have a number of functions like this:</p>
  
  <pre><code>INLINE volatile void functionname( /* ... */ ) {
      /* ... */
      asm( /* ... */ ) // embedded assembly statements
      /* ... */
  }
  </code></pre>
  
  <p>There has to have been a reason for that usage.  Can anyone:</p>
  
  <p><strong>A</strong>. tell me what the original reason was; and</p>
  
  <p><strong>B</strong>. how to achieve the desired effect now?</p>
  
  <p>I'm using Ubuntu, and GCC 4.6.3.</p>
  
  <p><hr />
  <i>Note:</i>  The closest I've come to an explanation is that prior to GCC 2.5, you could spoof the 'noreturn' attribute that was implemented in 2.5 via the following:</p>
  
  <pre><code>void fatal( /* ... */ ) { /* ... */ exit(1); }
  
  typedef void voidfn ();
  
  volatile voidfn fatal;
  </code></pre>
  
  <p>This would allow the compiler to recognize that 'fatal' was not going to return.</p>
  
  <p>But that scenario doesn't appear to apply to the AES code.  It's been a long time since I did anything in assembly, but I think I'd recognize a jump or something like that.</p>