title: Does temporary object creation depends on the C++ compiler?
body: <p>Does temporary object creation depends on the compiler?</p>
  
  <p>In the code bellow, I call a function sending a char* but the function requires an Object reference. However, Object has a constructor that uses a char*.. So a temporary object is automatically created and send to the print function.</p>
  
  <pre><code>class Object {
      string text;
    public:
      Object ( const char* value ) { text = value; }
      void print() const { printf( "[%s]\n", text.c_str() ); }
  };
  
  void print( const Object&amp; obj ) { obj.print(); }
  
  int main() {
      print( "hello" );
  }
  </code></pre>
  
  <p>Does this behavior depends on the compiler?
  You can see the output here: <a href="http://codepad.org/AABw5Ulz" rel="nofollow">http://codepad.org/AABw5Ulz</a></p>