[Qt-interest] Curious about deprecation messages in 4.7
Thiago Macieira
thiago at kde.org
Mon Sep 27 20:59:02 CEST 2010
Em Segunda-feira 27 Setembro 2010, às 12:08:28, Alexandre Beraud escreveu:
> And also QString(NULL) which used to compile smoothly with earlier
> versions of Qt.
Though that's a weird case. Why do you want to write QString(NULL)?
Note that it's not calling the QString constructor with a null char* or const
char*. Remember that NULL in C++ is actually the literal 0. So you're
technically writing:
QString(0)
What was meant with that? An empty/null string? A QString containing a NUL
character (i.e., QString(QChar(0)) )? Or a QString containing the number zero?
Moreover, even we take C++0x's nullptr to make the decision unambiguous, I
still have to ask: why do you need to pass a null? The default constructor
with no arguments will do the same.
The cases where I've seen this code are relics from Qt3 and should be fixed to
simply use QString(), which produces the exact same result, but is much faster
because it's entirely inline.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
Qt Developer Days 2010 - Munich Oct 11-13 - San Francisco Nov 1-3
For more information and to register: http://qt.nokia.com/qtdevdays2010
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100927/3a70b7b5/attachment.bin
More information about the Qt-interest-old
mailing list