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: Zhou Lei
Subject: Re: Anyone could help me with this memeory problem...
Date: Thu, 24 Feb 2005 09:08:07 +0000
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Paul Pluzhnikov wrote:
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,

Thank you again and I did it as you said, that helped me a lot. And can you recommend some short and efficient source code that I can read, so I can improve my programming skills using C++?


reply via email to

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