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

Thiago Macieira thiago.macieira at intel.com
Thu Jan 5 16:20:12 CET 2023


On Thursday, 5 January 2023 11:54:58 -03 Cathal Tummon (ctummon) via Interest 
wrote:
> Sorry to clarify, I'm not questing why it is needed, my question is, is the
> following redundant: QStringLiteral(u"myText")
> 
> 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?

Correct. The u is not required for any compliant compiler. The problem is only 
if your compiler is broken (i.e., MSVC).

See the discussion on commit d80b0eb12c477592b590b768e21dc26c137beadc[1] and 
on the MSFT bug report.

[1] https://code.qt.io/cgit/qt/qtbase.git/commit/?
id=d80b0eb12c477592b590b768e21dc26c137beadc

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





More information about the Interest mailing list