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

Thiago Macieira thiago.macieira at intel.com
Thu Jan 5 15:47:39 CET 2023


On Thursday, 5 January 2023 11:13:06 -03 Cathal Tummon (ctummon) via Interest 
wrote:
> 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.html
> https://codebrowser.dev/qt6/qtbase/src/corelib/text/qstringliteral.h.html
> 
> 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 
https://developercommunity.visualstudio.com/t/improper-concatenation-of-c11-unicode-strings/174549

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