[Development] QLatin1Constant and QtContacts / QtOrganizer

Thiago Macieira thiago.macieira at intel.com
Tue Dec 20 15:41:46 CET 2011


On Tuesday, 20 de December de 2011 13.37.54, harald.fernengel at nokia.com wrote:
> Hi,
> 
> > The difference is that QLatin1String will make an inline call to
> > strlen(latin1data), which the compiler may be able to optimise. Then
> > again, we could make the same in QString::fromLatin1... any takers?
> 
> review?
> 
> http://codereview.qt-project.org/#change,11530

Done. The same could be done for QString::fromUtf8.

I have some thoughts on improving the conversion code, as we've said before we 
wanted the QString "const char*" methods to convert using UTF-8 instead of 
Qt2-compat fromAscii. If we do that, those methods should be inlined as well 
so the string length could be calculated by the compiler.

Also note that C++11's u8"Literal string" produces a "const char *". There is 
no char type for UTF-8, like UTF-16 and UTF-32.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111220/b66d5e5e/attachment.sig>


More information about the Development mailing list