Abdelrazak Younes <[EMAIL PROTECTED]> writes:
> > The temporary QCString object created as return value of 'fromUnicode'
> > will be destroyed at the end of the full expression, i.e. basically at
> > the semicolon in the first line.
> 
> No, it is a QByteArray and QByteArray::data() returns explicitely a 
> valid char*. Read the Qt4 doc man.

Hmmm. How does your example differ from mine?

char const * using_this_returned_value_is_undefined_behaviour()
{
  char const * cdata = std::string("data").c_str();
  return cdata;
}

The lifetime of std::string::c_str() is no longer than the lifetime of
std::string...

How does QByteArray overcome that?

Angus

Reply via email to