On Friday 28 February 2014 08:46:12 Thiago Macieira wrote:
> Em sex 28 fev 2014, às 08:17:54, Thiago Macieira escreveu:
> > Em sex 28 fev 2014, às 13:00:31, Koehne Kai escreveu:
> > > > -----Original Message-----
> > > > From: [email protected]
> > > > [...]
> > > > qDebug("%ls", string.utf16());
> > > 
> > > This will actually not compile with gcc, because we tell the compiler
> > > explicitly we're printf-compatible:
> > > 
> > > error: format '%ls' expects argument of type 'wchar_t*', but argument 1
> > > has
> > > type 'const ushort* {aka const short unsigned int*}' [-Werror=format=]
> > > 
> > > Argh.
> > 
> > We can turn that error off. But it will also stop catching other printf
> > errors.
> 
> Another solution is to add another wrapper, like qPrintable, that does this:
> 
> #define qWPrintable(s)        (s.toStdWString().c_str())
> 
> So:
>       qDebug("%ls\n", qWPrintable(s));

That will not work because sizeof(wchar_t) is 4 on linux.
(and QString::vsprintf wands %ls to be ushort*)

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to