[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: QString porting tips for KDE
From: Warwick Allison <warwick () troll ! no>
Date: 1999-03-31 8:53:40
[Download RAW message or body]
There is still a LOT of scary char*/QCString/QString code, like this:
274 char *t = (char*)kapp->checkRecoverFile("UnNamed.xpm", r);
275 QString tmp = t;
276 if(t)
277 delete t;
checkRecoverFile returns a QString.
A good tip is: don't cast away const from "const char*". It's always wrong.
It may be worth putting a break-point in QString::ascii() and methodically
removing all these casts. Almost every bug I've found tonight (... today,
whatever it is now) has been a result of this kind of thing. Casting is evil
(cache pattern not withstanding).
It's really a job for a script I guess, but note that both of the "const"
below are meaningless (many compilers will even tell you so):
const QString Foo:bar(const QString p);
The recommended signature would be:
QString Foo:bar(const QString& p);
--
Warwick
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic