Cpp Coding Standards/CLSDESIGN/NewDel

From Apache OpenOffice Wiki
Jump to: navigation, search

Failing to provide both of Class::operator new and Class::operator delete can subtly leak memory (because compiler-generated code, such as automatic resource deallocation during exception handling, needs it and might otherwise be silently left blank, if that operator is undefined).

Failing to provide all three forms of class-specific new/delete operators will hide the compiler provided default ones from your users. You should have good reasons to deprive them from that freedom.

Personal tools