Expensive QString = ""
André Wöbbeking
kde-optimize@mail.kde.org
Wed, 12 Mar 2003 18:43:30 +0100
On Wednesday 12 March 2003 01:18, Alexander Kellett wrote:
> On Wed, Mar 12, 2003 at 01:02:25AM +0100, Andr? W?bbeking wrote:
> > I don't know, if QString = "" appears frequently in time critical code
> > (KHtml, KDE start up, KConfig, ...), but if you really need an empty
> > QString the better solution would be to use a static const QString like
> > QString::null.
>
> just fyi,
> (QString::null).isNull() != QString("").isNull())
I know this. It's the reason, I wrote "but if you really need..."
> therefore, they can't just be randomly switched over.
This depends on the developer's intention. Did he used it, because he's used
to (C programming, C++ std::string, ...) or was there a really reason for it.
> in fact i kind of dislike the use of a null string
> in place of an formally empty string, its just not
> explicit enough for my liking.
Hm, don't know. There is null in databases, you can also find null objects in
Design Patterns and probably somewhere else.
André