title: Clear variable on the stack
body: <h2>Code Snippet:</h2>
  
  <pre><code>int secret_foo(void)
  {
    int key = get_secret();
    /* use the key to do highly privileged  stuff */
    ....
  
    /* Need to clear the value of key on the stack before exit */
    key = 0;      
    /* Any half decent compiler would probably optimize out the statement above */
    /* How can I convince it not to do that? */
  
    return result;
  }
  </code></pre>
  
  <p>I need to clear the value of a variable <code>key</code> from the stack before <code>return</code>ing (as shown in the code).</p>
  
  <p>In case you are curious, this was an actual customer requirement (embedded domain).</p>