Difference between revisions of "Cpp Coding Standards/FDESIGN"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Topic-Id: '''FDESIGN'''
+
== Function Design (FDESIGN) ==
 +
''Design of functions and function prototypes.''<br>
 +
''Items referring to code in function bodies, reside in topic [[../Function Implementation|FIMPL]] - Function Implementation.''
  
Design of functions and function prototypes. Items referring to code in function bodies, reside in topic [[../Function Implementation|FIMPL]] - Function Implementation.
+
===== One Task <span id="OneTask">(OneTask)</span> =====
 +
Give a function only one cohesive task. [[/OneTask|-> Details]]
  
----
+
===== Canonical Operators <span id="CanOp">(CanOp)</span> =====
=== Summary ===
+
Use canonical signatures for all operator overloads. Provide canonical behavior for arithmetic operators. [[/CanOp|-> Details]]
==== One Task <span id="OneTask">(OneTask)</span> ====
+
Give one function only one cohesive task.
+
  
[[/OneTask|Details]]
+
===== Unambiguous Parameters <span id="Params">(Params)</span> =====
 +
Mark parameter intention unambiguously. Out- and inout- parameters need to be distinguished unmistakably. <br>
 +
Use smart pointers as parameter type for objects on the heap, when the responsibility for deleting is unclear or transfered between caller and callee. [[/Params|-> Details]]
  
==== Canonical Operators <span id="CanOp">(CanOp)</span> ====
+
----
Use canonical signatures for all operator overloads. Provide canonical behavior for arithmetic operators.
+
==== Related Rules ====
 +
'''Short Functions''' [[../FIMPL#Short|-> FIMPL:Short]]
  
[[/CanOp|Details]]
+
'''Consistency''' [[../IFC#Consi|-> IFC:Consi]]
  
==== Unambiguous Parameters <span id="Params">(Params)</span> ====
+
'''Unambiguous Overloads''' [[../IFC#Over|->IFC:Over]]
Mark parameter intention unambiguously. Out- and inout- parameters need to be distinguished unmistakably.
+
 
+
Use smart pointers as parameter type for objects on the heap, when the responsibility for deleting is unclear or transfered between caller and callee.
+
 
+
[[/Params|Details]]
+
 
+
----
+
=== Related Rules ===
+
* [[../Function Implementation#Short | FIMPL:Short]] - Short Functions
+
* [[../Interfaces#Consi |IFC:Consi]] - Consistency
+
* [[../Interfaces#Over |IFC:Over]] - Unambiguous Overloads
+
  
 
----
 
----
 
[[Category:Coding Standards]]
 
[[Category:Coding Standards]]

Latest revision as of 09:08, 23 May 2007

Function Design (FDESIGN)

Design of functions and function prototypes.
Items referring to code in function bodies, reside in topic FIMPL - Function Implementation.

One Task (OneTask)

Give a function only one cohesive task. -> Details

Canonical Operators (CanOp)

Use canonical signatures for all operator overloads. Provide canonical behavior for arithmetic operators. -> Details

Unambiguous Parameters (Params)

Mark parameter intention unambiguously. Out- and inout- parameters need to be distinguished unmistakably.
Use smart pointers as parameter type for objects on the heap, when the responsibility for deleting is unclear or transfered between caller and callee. -> Details


Related Rules

Short Functions -> FIMPL:Short

Consistency -> IFC:Consi

Unambiguous Overloads ->IFC:Over


Personal tools