a text on optimizing C++
Lubos Lunak
kde-optimize@mail.kde.org
Mon, 27 Jan 2003 12:08:29 +0100
On Friday 24 of January 2003 23:43, David Faure wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Friday 24 January 2003 23:29, Waldo Bastian wrote:
> > On Friday 24 January 2003 20:07, Martijn Klingens wrote:
> > > On Friday 24 January 2003 14:13, Lubos Lunak wrote:
> > > > {
> > > > KConfig cfg( "somerc" );
> > > > cfg.writeEntry( "Entry", "Value" );
>
> A setGroup is missing, right?
Hmm, yes, I forgot. But it doesn't really change anything on the example.
>
> > > > }
> > > >
> > > > is exactly the same (and the {}'s are not needed if the calling of
> > > > the destructor may wait until the end of the function/block it's in).
> > > > It saves one dynamic allocation and deallocation, and there will be
> > > > no leak.
> > >
> > > What are your thoughts on
> > >
> > > KConfig( "somerc" ).writeEntry( ... );
>
> There's no group here either.
>
> > > then? I sometimes tend to fold statements together like this but I
> > > hardly see it done elsewhere, making me wonder if it's maybe a bad
> > > habit of mine.
>
> The best way is rather something like
> KConfigGroup( KGlobal::config(), "mygroup" ).writeEntry( key, value );
> (for a single entry to be written).
I think this is unnecessarily cryptic.
--
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/