Posts

Showing posts with the label coding-style

Is calling destructor manually always a sign of bad design?

Is calling destructor manually always a sign of bad design? I was thinking: they say if you're calling destructor manually - you're doing something wrong. But is it always the case? Are there any counter-examples? Situations where it is neccessary to call it manually or where it is hard/impossible/impractical to avoid it? How are you going to deallocate the object after calling the dtor, without calling it again? – ssube Jan 6 '13 at 21:36 @peachykeen: you would call placement new to initialize a new object in place of the old. Generally not a good idea, but it isn't unheard of. – D.Shawley Jan 6 '13 at 21:38 new Look at "rules" that co...