[Development] FW: Backwards compatibiltiy break in Qt 5.5

Sze Howe Koh szehowe.koh at gmail.com
Tue Jul 28 12:51:20 CEST 2015


On 28 July 2015 at 15:28, Olivier Goffart <olivier at woboq.com> wrote:
> On Monday 27. July 2015 10:03:25 Thiago Macieira wrote:
>> The whole thinking is that the use of operator<< for QString implies you're
>> trying to figure out why that string is the way it is, as opposed to trying
>> to convey a message.
>
> I think that's where the disagreement is.
>
> I would think the use of operator<< for QString is just trying to figure out
> WHAT is that string.
>
> Most of the code looks like
>   qDebug() << "There was an error processing XYZ: " << job->errorString();
>   qDebug() << "Error parsing file: " << fileName;
>   qDebug() << "User entered: " << searchLineEdit->text();

I certainly do this a lot. My main use cases are:

* (During development) To track the flow of my code, when breakpoints
and stepping are too slow.
* (In production) To generate human-readable logs

There are many use cases for qDebug/qCDebug that are very different
from the use case in Qt Test that triggered this change. Yes, Qt Test
needs to unambiguously output NON-printable characters to show the
developer where the strings are mismatched. However, please remember
users who want to read printable characters without having to bloat
their code with qUtf8Printable(). (One reason I prefer qDebug over
std::cout is because qDebug is so much cleaner; requiring
qUttf8Printable() everywhere kills this advantage if English is not my
main language)

Furthermore, there was a recent argument against replacing Qt XML's
backend which is relevant here too: "...you may *fix* bugs that people
are accidentally depending on; or the simple fact of a change in
behaviour could result in existing code getting broken." [1]


> Imagine that in a app written in russian for russian, or in other languages.
> You really want to know what is the error message or the file name.
>
> I use qDebug a lot, and I don't recall a single time I had problems with
> homoglyph. However I already was annoyed by the Qt 5.5's escaping.
>
> So if you ask my opinion, I think this regression should be fixed in Qt 5.5.x.

+1.

I do agree with Thiago's rationale of removing ambiguity and
inconsistency in qDebug. However, given that the change "breaks" (or
provides "unwelcome fixes" to) lots of existing code, the old
behaviour should be kept as default IMHO.


Regards,
Sze-Howe

[1] http://permalink.gmane.org/gmane.comp.lib.qt.devel/22647



More information about the Development mailing list