Difference between revisions of "Cpp Coding Standards/CLSDESIGN/NewDel"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
Line 2: Line 2:
  
 
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.
 
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.
 +
 +
 +
[[Category:Coding Standards]]

Latest revision as of 23:07, 19 July 2007

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