[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KDE 1.1.2 khtmlw memory leak patch - please test!
From: Stephan Kulow <coolo () caldera ! de>
Date: 1999-08-30 15:57:59
[Download RAW message or body]
Bernd Gehrmann wrote:
>
> On Mon, 30 Aug 1999 Waldo Bastian wrote:
>
> >It's good programming practice to _always_ reset a pointer to 0 after
> >delting it. Perhaps another destructor gets called (itn the parent
> >object) which calls a virtual function which checks the pixmap
> >pointer.....
>
> >It's good programming practice to _always_ reset a pointer to 0 after
> >delting it. Perhaps another destructor gets called (itn the parent
> >object) which calls a virtual function which checks the pixmap
> >pointer.....
>
> These are exactly the considerations which led to the design decision
> that in C++ this is not possible! After the execution of the destructor,
> all variables declared in the corresponding class are undefined. So
> setting a variable at the end of the destructor is not good programming
> practice, as it deludes the reader of the code into thinking that the
> assignment has any effect.
This is not true. As Waldo pointed out, the variable may be owned by
a base class, so setting it to 0 has an effect.
Greetings, Stephan
--
Programmers, heed this: If someone starts asking you about
agricultural genomes, it's likely time to get a handler.
zdnet.com about Torvalds
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic