title: Function-Local Static variable For Unique Id Generation
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2705679/id-generator-with-local-static-variable-thread-safe">ID generator with local static variable - thread-safe?</a>  </p>
  </blockquote>
  
  
  
  <p>Would the following function return a unique number every time it is called? What about in a multi-threaded scenario? </p>
  
  <pre><code>int returnUniqueNumber()
  {
    static int i = 0;
    ++i;
    return i;
  }
  </code></pre>