[Development] Backwards compatibiltiy break in Qt 5.5

Thiago Macieira thiago.macieira at intel.com
Mon Jul 27 22:27:03 CEST 2015


On Monday 27 July 2015 22:01:26 Andreas Aardal Hanssen wrote:
> > On 27 Jul 2015, at 21:14, Thiago Macieira <thiago.macieira at intel.com>
> > wrote:> 
> > On Monday 27 July 2015 21:50:15 NIkolai Marchenko wrote:
> >> Oh, but now you KNOW that it is a misspeled link to paypal. In real
> >> situation you won't have this forward knowlegde.
> > 
> > The point is that I have all of the information I need. If I see a debug
> > output saying:
> > 
> > ClassName::openLink: trying to open "\u0440\u0430\u0443\u0440\u0430l.
> > \u0441\u043em"
> 
> Thiago what was the original cause for the change? Shouldn’t a change like
> this be argued in, rather than out?

It was argued for and approved by the reviewers. It did not seem such a big 
deal, which is why it wasn't brought up to the list. Now we need to decide 
whether to go back, continue or change again.

The whole story is as follows:

For Qt 5.4, I changed QtTest printing of QStrings. See 
579526cfec082679241548a0fca1ff9ba2c350a7:
    Make the printing of complex Unicode in a QString prettier
    
    This also has the advantage of not requiring the use of the locale
    codec. Quite an advantage if you're debugging the locale codec. But it's
    mostly so that we don't get question marks that hide the difference we
    were trying to locate.
    
    [ChangeLog][QtTest] QtTest now prints an escaped version of QStrings
    that failed to compare with QCOMPARE. That is, instead of converting
    non-printable characters to question marks, QtTest will print the
    Unicode representation of the character in question.

This was a net benefit because, like the commit message says, it avoided the 
conversion from non-ASCII to question marks, which often hid the exact 
character you were trying to compare.

I had a corresponding change for QByteArray, but it did not integrate in time 
for 5.4 branching, so landed in 5.5 as 
f5b609cac864e010085d5965b84832b2d85643e6
    Make the printing of complex byte arrays prettier
    
    Similar to what we've done to QString, only we print each byte that is
    not ASCII as \OOO (octal representation).
    
    [ChangeLog][QtTest] QtTest now prints an escaped version of
    QByteArrays that failed to compare with QCOMPARE, instead of the hex
    dump.

This was again a net benefit because the common case of QByteArray is to 
contain an arbitrarily-encoded human text.

After I'd done that, we decided that we'd actually do the same for QDebug as 
it's used in often the same situations as QtTest.

Also note that we changed from octal to hex at Ossi's insistence, which made 
the code a more complex in the process.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list