09.11.2017, 12:16, "Nikos Chantziaras" <rea...@gmail.com>:
> On Windows, I use this:
>
>    void func(const wchar_t*);
>    QString s;
>
>    // ...
>
>    func(reinterpret_cast<const wchar_t*>(s.utf16()));
>
> This saves an allocation, a copy and a free since I don't have to use
> QString::toWCharArray(). However, is this actually safe? "It seems to
> work," and AFAIK, QString::d->data() is already in the format and
> encoding Windows excepts a wchar_t* to be. Is this correct?

Yes, if you make sure this code is used only on Windows.
You may want to add static assert that sizeof wchar_t == sizeof ushort

>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Regards,
Konstantin
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to