Difference between revisions of "Cpp Coding Standards/CLSINIT"
From Apache OpenOffice Wiki
m |
m |
||
Line 1: | Line 1: | ||
− | # | + | === Class Construction, Destruction and Copying (CLSINIT) - Summary === |
+ | ''Special issues of constructors, copying and destructors.'' | ||
+ | |||
+ | ===== No Virtual Calls in Constructor or Destructor <span id="NoVirt">(NoVirt)</span> ===== | ||
+ | Don't call your own class' virtual functions in a constructor or destructor.<br> | ||
+ | [[/NoVirt|Details >]] | ||
+ | |||
+ | ===== Constructor Initialization Section <span id="InitSect">(InitSect)</span> ===== | ||
+ | Use the constructors initialization section to initialize your members. [[/InitSect|Details >]] | ||
+ | |||
+ | ===== Obvious Copyability <span id="ObvCopy">(ObvCopy)</span> ===== | ||
+ | Make it obvious, if the class is intended to be copied. Forbid copying otherwise. [[/ObvCopy|Details >]] | ||
+ | |||
+ | ===== Copy and Assign Consistently <span id="CopyAssign">(CopyAssign)</span> ===== | ||
+ | Declare copy and assignment operators consistently – either both, or none. [[/CopyAssign|Details >]] | ||
+ | |||
+ | ---- | ||
+ | === Related Rules === | ||
+ | * [[../Class Design#NoConv |CLSDESIGN:NoConv]]- No Implicit Conversions | ||
+ | * [[../Error Handling#NoFail |ERR:NoFail]] - Which Functions Never Fail | ||
+ | * [[../Virtual Classes#RightDestr |VIRTUAL:RightDestr]] - Right Destructor | ||
+ | * [[../Virtual Classes#SafeCopy |VIRTUAL:SafeCopy]] - Safe Copying | ||
+ | |||
+ | ---- | ||
+ | [[Category:Coding Standards]] |
Revision as of 10:42, 13 April 2007
Contents
Class Construction, Destruction and Copying (CLSINIT) - Summary
Special issues of constructors, copying and destructors.
No Virtual Calls in Constructor or Destructor (NoVirt)
Don't call your own class' virtual functions in a constructor or destructor.
Details >
Constructor Initialization Section (InitSect)
Use the constructors initialization section to initialize your members. Details >
Obvious Copyability (ObvCopy)
Make it obvious, if the class is intended to be copied. Forbid copying otherwise. Details >
Copy and Assign Consistently (CopyAssign)
Declare copy and assignment operators consistently – either both, or none. Details >
Related Rules
- CLSDESIGN:NoConv- No Implicit Conversions
- ERR:NoFail - Which Functions Never Fail
- VIRTUAL:RightDestr - Right Destructor
- VIRTUAL:SafeCopy - Safe Copying