[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-optimize
Subject: Re: QString: Allocating more than needed?
From: Harri Porten <porten () trolltech ! com>
Date: 2003-01-26 11:43:53
[Download RAW message or body]
On Sun, 26 Jan 2003, David Faure wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sunday 26 January 2003 11:20, Stefan Heimers wrote:
> > - Is there a way to create qstrings with a fixed length, which won't
> > waste memory in case you know they will never grow?
>
> Yes, setLength().
Now please don't go around and add setLength() calls everywhere like
QString s = "foo";
s.setLength( 3 );
That won't pay off (and work) :)
> > - It would be nice to have an option to set the maximum expected length
> > of a qstring, so it won't allocate in excess, or too little if you know
> > a string will grow considerably.
>
> setLength() ? :)
This latter is the intented and "good" usage.
Harri.
_______________________________________________
Kde-optimize mailing list
Kde-optimize@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-optimize
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic