a text on optimizing C++
Martijn Klingens
kde-optimize@mail.kde.org
Fri, 24 Jan 2003 20:07:09 +0100
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.
--
Martijn