Andre Poenitz a écrit :
On Fri, May 05, 2006 at 09:31:14PM +0200, Abdelrazak Younes wrote:
No it is char const * issue. I said remove the const and it will be all right:

char * foo = codec->fromUnicode(str).data();
return foo[0];

This should work on VC++ and gcc.

This is undefined behaviour.

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.

Abdel.

Reply via email to