a text on optimizing C++
Waldo Bastian
kde-optimize@mail.kde.org
Fri, 24 Jan 2003 23:29:59 +0100
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" );
> > }
> >
> > 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( ... );
>
> 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.
It only works as long as you need to write one entry.
Cheers,
Waldo
--
bastian@kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian@suse.com