title: Why do un-named C++ objects destruct before the scope block ends?
body: <p>The following code prints one,two,three.  Is that desired and true for all C++ compilers?</p>
  
  <pre><code>
  class Foo
  {
        const char* m_name;
  public:
        Foo(const char* name) : m_name(name) {}
        ~Foo() { printf("%s\n", m_name); }
  };
  
  void main()
  {
        Foo foo("three");
        Foo("one");   // un-named object
        printf("two\n");
  }
  </code></pre>