[Development] Let's please drop MSVC 2013 for 5.10
André Pönitz
apoenitz at t-online.de
Sat Jun 17 01:35:54 CEST 2017
On Fri, Jun 16, 2017 at 12:52:24PM -0700, Thiago Macieira wrote:
> Here's a tricky question: how do you create a QStringLiteral with non-ASCII
> characters that will work on all our supported compilers?
I don't have to, unless I have profiler supported evidence that
it matters.
In the common case where it does not matter, the string can be
created at run time.
For the rare (vulgo: non-existent) case where that would matter
in Qt sources, something QStringLiteral-like along the lines of
#define QSTRINGLITERAL(...) \
[]() -> QString { \
const ushort X[] = { __VA_ARGS__ }; \
enum { Size = sizeof(X) / sizeof(X[0]) }; \
static const QStaticStringData<Size> qstring_literal = { \
{ Q_REFCOUNT_INITIALIZE_STATIC, Size, 0, 0, sizeof(QStringData) }, \
__VA_ARGS__ \
}; \
QStringDataPtr holder = { qstring_literal.data_ptr() }; \
const QString qstring_literal_temp(holder); \
return qstring_literal_temp;
}()
and using
QSTRINGLITERAL('M', 0xf6, 0xf6, 0xf6, 'p', '!')
instead of
QStringLiteral("Möööp!")
should be possible to use, too.
Andre'
More information about the Development
mailing list