comments on KDE performance tips

Carsten Pfeiffer kde-optimize@mail.kde.org
Sat, 18 Jan 2003 03:03:15 +0100


-----BEGIN PGP SIGNED MESSAGE-----

On Saturday 18 January 2003 02:47, David Faure wrote:
> On Saturday 18 January 2003 02:16, Roger Larsson wrote:
> > 	const QString hallo = "hallo"; // constructor with copy
> > 	if (hallo == hallo) ...  // only compares the string storage location
>
> Nope. This calls QString::operator==, which compares the contents.
> Please don't confuse QString and e.g. char *.

But doesn't it check whether they share the same data first? Looking... yes, 
it does. Then it compares the length of the strings and only then the 
contents.

Cheers
Carsten Pfeiffer
-----BEGIN PGP SIGNATURE-----

iQEVAwUBPii146WgYMJuwmZtAQGwGwgAvGQJQ7rR/2SLdaswN6MOIOKpNwLiCa6y
0j+97CoK+jPPb6q1r5+b25YUnXz64p1oko1qukKvd95KHLoUsxmikv+Zub2O4uVE
5oMrmS9hb4Z+wylQlZqc6JBO9bny2GA5SAHA77F3afWTCroQGRjPb54onm7dgUsh
b40RLSLKWS+AmWb+iUJLUAH2UqODNb75mDRoa3Naa2fxZjkvxE89z7OMQmDBM3Q8
8n1v01fC4GYj7bmvJZGn730fdsskGzbK3plwtW/23W6vDbuEdeWoOSK+dhr4RX5w
jHm30OFOK+KWKqplmUaX2hXSg+ckBBSsXcgMYL/dZRiQ9GSYC6q6Fw==
=QPWq
-----END PGP SIGNATURE-----