Difference between revisions of "Cpp Coding Standards/CLSINIT"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m
 
Line 1: Line 1:
=== Class Construction, Destruction and Copying (CLSINIT) - Summary ===
+
== Class Construction, Destruction and Copying (CLSINIT) ==
 
''Special issues of constructors, copying and destructors.''
 
''Special issues of constructors, copying and destructors.''
  
 
===== No Virtual Calls in Constructor or Destructor <span id="NoVirt">(NoVirt)</span> =====
 
===== 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>
+
Don't call your own class' virtual functions in a constructor or destructor. [[/NoVirt|-> Details]]
[[/NoVirt|Details >]]
+
  
 
===== Constructor Initialization Section <span id="InitSect">(InitSect)</span> =====
 
===== Constructor Initialization Section <span id="InitSect">(InitSect)</span> =====
Line 14: Line 13:
 
===== Copy and Assign Consistently <span id="CopyAssign">(CopyAssign)</span> =====
 
===== Copy and Assign Consistently <span id="CopyAssign">(CopyAssign)</span> =====
 
Declare copy and assignment operators consistently – either both, or none. [[/CopyAssign|Details >]]
 
Declare copy and assignment operators consistently – either both, or none. [[/CopyAssign|Details >]]
 
 
----
 
----
=== Related Rules ===
+
==== Related Rules ====
* [[../Class Design#NoConv |CLSDESIGN:NoConv]]- No Implicit Conversions
+
'''No Implicit Conversions''' [[../CLSDESIGN#NoConv|-> CLSDESIGN:NoConv]]
* [[../Error Handling#NoFail |ERR:NoFail]] - Which Functions Never Fail
+
 
* [[../Virtual Classes#RightDestr |VIRTUAL:RightDestr]] - Right Destructor
+
'''Which Functions Never Fail''' [[../ERR#NoFail|-> ERR:NoFail]]
* [[../Virtual Classes#SafeCopy |VIRTUAL:SafeCopy]] - Safe Copying
+
 
 +
'''Right Destructor''' [[../VIRTUAL#RightDestr|-> VIRTUAL:RightDestr]]
  
 +
'''Safe Copying''' [[../VIRTUAL#SafeCopy|-> VIRTUAL:SafeCopy]]
 
----
 
----
 
[[Category:Coding Standards]]
 
[[Category:Coding Standards]]

Latest revision as of 08:56, 23 May 2007

Class Construction, Destruction and Copying (CLSINIT)

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

No Implicit Conversions -> CLSDESIGN:NoConv

Which Functions Never Fail -> ERR:NoFail

Right Destructor -> VIRTUAL:RightDestr

Safe Copying -> VIRTUAL:SafeCopy


Personal tools