Difference between revisions of "Cpp Coding Standards/FDESIGN"
From Apache OpenOffice Wiki
m (Cpp Coding Standards/Function Design moved to Cpp Coding Standards/FDESIGN: simplicity;revert change) |
(formatting) |
||
Line 1: | Line 1: | ||
− | + | === Function Design (FDESIGN) - Summary === | |
+ | ''Design of functions and function prototypes.''<br> | ||
+ | ''Items referring to code in function bodies, reside in topic [[../Function Implementation|FIMPL]] - Function Implementation.'' | ||
− | + | ===== One Task <span id="OneTask">(OneTask)</span> ===== | |
+ | Give one function only one cohesive task. [[/OneTask|-> Details]] | ||
− | + | ===== Canonical Operators <span id="CanOp">(CanOp)</span> ===== | |
− | === | + | Use canonical signatures for all operator overloads. Provide canonical behavior for arithmetic operators. [[/CanOp|-> 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]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ==== Unambiguous Parameters <span id="Params">(Params)</span> ==== | + | |
− | 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]] | + | |
---- | ---- |
Revision as of 14:52, 12 April 2007
Contents
Function Design (FDESIGN) - Summary
Design of functions and function prototypes.
Items referring to code in function bodies, reside in topic FIMPL - Function Implementation.
One Task (OneTask)
Give one 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
- FIMPL:Short - Short Functions
- IFC:Consi - Consistency
- IFC:Over - Unambiguous Overloads