Just to be clear: my point was NOT about using a temp objects.

Back to our discussion:
The data buffer in the temporary QByteArray is a transformed copy of the data buffer that is in the string's buffer.
I just checked and you are right:
toAscii() (via toLatin1()) indeed transforms the data:
Qt Code:
  1. QByteArray QString::toLatin1() const
  2. {
  3. if (d->size) {
  4. ba.resize(d->size);
  5. const ushort *i = d->data;
  6. const ushort *e = d->data + d->size;
  7. uchar *s = (uchar*) ba.data();
  8. while (i != e) {
  9. *s++ = (*i>0xff) ? '?' : (uchar) *i;
  10. ++i;
  11. }
  12. }
  13. return ba;
  14. }
To copy to clipboard, switch view to plain text mode 

One of the main disadvantages answering such post during work is that I can often just skim the posts. :-\