"-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII" as policy in kde
David Faure
faure at kde.org
Mon Nov 15 18:25:36 GMT 2010
On Wednesday 06 October 2010, Parker Coates wrote:
> But I just don't think wrapping every
> single literal with a constructor or conversion function is improving
> code quality. [2]
Right. In the code you linked to, it's apparent that
1) KIcon is almost always used with a const char* litteral as argument, so we
should add a set of const char* constructor overloads to KIcon
(IIRC this means we have to add qbytearrays too, otherwise existing code using
a qbytearray becomes ambiguous... This sounds like an unlikely case though, so
I don't know if we need to do that, maybe I can check compilation of
trunk/KDE+extragear without qbytearray constructors and ignore the corner case
to avoid unnecessary API bloat?)
2) KActionCollection::addAction() is also almost always used with "..."
litterals, so maybe we should do the same there (but then this could be
applied to every API that uses action names, and there might be much of it).
PS: after this thread, I made kdecore fully compile with
QT_NO_CAST_FROM_ASCII. Found 3 encoding bugs. But indeed let's do this right
if we do it above in the stack too. Icon names and action names are a very
very unlikely place for encoding bugs...
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
More information about the kde-core-devel
mailing list