[Interest] QStringLiteral and UTF-16 string literal "u"

Cathal Tummon (ctummon) ctummon at cisco.com
Thu Jan 5 15:54:58 CET 2023

Hi Thiago,

Sorry to clarify, I'm not questing why it is needed, my question is, is the following redundant:

As in the source code for QStringLiteral there is another macro:
#define QT_UNICODE_LITERAL(str) u"" str

Which always seems to be used, is that correct?

Thanks again,

-----Original Message-----
From: Thiago Macieira <thiago.macieira at intel.com> 
Sent: 05 January 2023 15:48
To: interest at qt-project.org
Cc: Cathal Tummon (ctummon) <ctummon at cisco.com>
Subject: Re: [Interest] QStringLiteral and UTF-16 string literal "u"

On Thursday, 5 January 2023 11:13:06 -03 Cathal Tummon (ctummon) via Interest
> Hi there,
> I'm trying to figure out if the "u" is still necessary at any point 
> when using QStringLiteral.

It's not and has never been, except for broken compilers that failed to implement C++11 properly.

> It seems to be always prepended according to the source code:
> https://codebrowser.dev/qt5/qtbase/src/corelib/text/qstringliteral.h.h
> tml 
> https://codebrowser.dev/qt6/qtbase/src/corelib/text/qstringliteral.h.h
> tml
> But the documentation still references it in examples and even has a 
> caveat that it could be necessary for some compilers:
> https://doc.qt.io/qt-6/qstring.html#QStringLiteral
> Just wondering if this is still the case and I am missing something?

Git blame for that text takes us to  d80b0eb12c477592b590b768e21dc26c137beadc,
which closed task https://bugreports.qt.io/browse/QTBUG-65479. That has a link to the MSFT bug report

Which appears to have been closed without solution. I have no interest in retesting to see if the problem still exists in current versions. I've already done my part in reporting.

And ICC on Windows is not supported. It has never worked for as long as I've worked on Qt and now fails to even compile Qt, despite (or more precisely, because of) being replaced by Clang-cl.

So I'm leaving the text as-is.

Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering

More information about the Interest mailing list