[Development] FW: Backwards compatibiltiy break in Qt 5.5

Olivier Goffart olivier at woboq.com
Wed Jul 29 09:11:36 CEST 2015


On Tuesday 28. July 2015 12:24:16 Thiago Macieira wrote:
> I don't think I am underestimating the annoyance to those people nor that I
> am overestimating the benefit. You have also take into account that a great
> majority of source code is written in English and for those cases this
> feature is a net win.
> 
> Anyway, I'm waiting for Lars to make a decision.
> 
> Lars, you can either make your choices below or you may request consensus
> and then make your decision:

I know this is not a vote. But here is my opinion:
 
> 1) qDebug for QStrings should
>   a) escape everything non-US-ASCII (5.5.0 behaviour)
>   b) escape everything that isn't QChar::isPrint
>   c) escape only US-ASCII control characters (0 to 31), backslash and quote
>   d) escape only NUL, backslash and quote
>   e) escape nothing (5.0 through 5.4 behaviour)
>   [I haven't included option f) mangle irrevocably (4.x behaviour)]

I'd say b.
(or c if you think b is too slow, but maybe you can optimize and not call 
isPrint for ascii)

> 2) ditto for qDebug for QByteArrays, except that for:
>   b1) escape everything that isn't isprint() from ctype.h (locale dependent)
> b2) escape everything that isn't printable under Latin 1
>   Note that QByteArray::toUpper and toLower do not and have never used
> ctype.h and are instead fixed to Latin 1.

For QByteArray I think a. is ok (escape everything non ascii)
We don't know if the encoding is utf-8 or latin-1 so we can just escape 
everything.

> 3) QtTest should
>   a) follow qDebug and be consistent
>   b) do it differently, in which case we need to select which of the options
> above

QtTest printer do not have to be consistant. 
But both behaviour would be acceptable as far as I am concerned.

> 4) when to apply those changes, which are technically behaviour changes
>   a) 5.5.1
>   b) 5.6.0

5.5.1 for qDebug because it is a regression.

> Note that the QtTest QString change happened in 5.4.0, so I advise against
> changing QTest::toString(QString) in 5.5.1, if a change is to happen.

I agree.

> 
> Obviously my preference has already been stated. If we eliminate 1a, my
> preferences are: 1c and 2a. I do not want QChar::isPrint to be used because
> it's expensive.
> 
> Anything except 1e will still change "C:\Users" to "C:\\Users" in the
> output, which was one of the complaints listed.





More information about the Development mailing list