Hello,
does anybody know why in the following code 's' contains trash upon creation, but becomes valid after creating another QString?
#include <QApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
const QString
& s
= QString("hello").
append("world");
qDebug() << s; // s is invalid here (seen in the debugger)
qDebug() << s; // s is ok (??????)
return 0;
}
#include <QApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
const QString& s = QString("hello").append("world");
qDebug() << s; // s is invalid here (seen in the debugger)
QString t = QString("hello").append("world");
qDebug() << s; // s is ok (??????)
return 0;
}
To copy to clipboard, switch view to plain text mode
Qt 4.7
VS 2008 SP2
Vista
Bookmarks