In C++, is it a reflection of poor software design if objects are deleted manually?
Posted
by
grokus
on Programmers
See other posts from Programmers
or by grokus
Published on 2011-03-13T16:58:16Z
Indexed on
2011/03/14
0:17 UTC
Read the original article
Hit count: 260
With the advent of smart pointers, is it a sign of poor design if I see objects are deleted? I'm seeing some software components in our product that people are still doing this. This practice strikes me as un-idiomatic, but I need to be sure this is the industry consensus. I'm not starting a crusade but it'd be nice to be prepared theory wise.
Edit: legit uses of delete, Klaim mentioned the object pool use case. I agree.
Bad examples of using delete, I am seeing many new's in constructor or start() and corresponding delete's in the destructor or stop(), why not use scoped_ptr? It makes the code cleaner.
© Programmers or respective owner