Cpp Coding Standards/CLSDESIGN/NewDel

From Apache OpenOffice Wiki
< Cpp Coding Standards‎ | CLSDESIGN
Revision as of 23:07, 19 July 2007 by Kirk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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