Re: OT: Stupid c++
Classes should define a destructor if something needs to happen every time one gets destroyed (either by delete or by a non-static member going out of scope). It is important to prevent memory leaks if the class has any heap-allocated memory that it maintains the only pointer to and should remove when it dies.
If an object has no heap-allocated memory (i.e. it doesn't create anything with "new" or "malloc"), and if nothing needs to happen when it gets deleted, then it doesn't need a destructor.
However, I really doubt any worthwhile C++ compiler is going to have a fundamental problem with destructors or with delete. If it did, it would be seriously crippled. I expect probably you are seeing some other bug.
What are you deleting when you see problems? Objects with destructors that do things like use objects that are already destroyed?
|