help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anyone could help me with this memeory problem...


From: Paul Pluzhnikov
Subject: Re: Anyone could help me with this memeory problem...
Date: 23 Feb 2005 13:14:10 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Zhou Lei <dark_eaglet@hotmail.com> writes:

> class ptree { ...
>      void cleanup();            // Release the memory of trees.

After your fixes, cleanup() is no longer called.
If someone was to call it, the bug that you fixed would come
right back. You should (preferably) remove that function, or at
least fix it to work correctly.

>      ~ptree() {
>           if(lchild)
>                delete lchild;

The 'if (lchild)' check is redundant and unneccessary, because
'delete NULL;' is defined by the language to be a NO-OP.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]