title: Is returning a pointer to a static local variable safe?
body: <p>I'm working with some code that widely uses the idiom of returning a pointer to a static local variable.  eg:</p>
  
  <pre><code>char* const GetString()
  {
    static char sTest[5];
    strcpy(sTest, "Test");
    return sTest;
  }
  </code></pre>
  
  <p>Am I right in thinking that this is safe?</p>
  
  <p>PS, I know that this would be a better way of doing the same thing:</p>
  
  <pre><code>char* const GetString()
  {
    return "Test";
  }
  </code></pre>
  
  <p><strong>Edit:</strong>
  Apologies, the function signature should of course be:</p>
  
  <pre><code>const char* GetString();
  </code></pre>