Difference between revisions of "Cpp Coding Standards/FIMPL"
From Apache OpenOffice Wiki
m (Cpp Coding Standards/Topics/FIMPL moved to Cpp Coding Standards/Function Implementation: Improve Cpp_Coding_Standards structure.) |
m |
||
Line 20: | Line 20: | ||
---- | ---- | ||
=== Related Rules === | === Related Rules === | ||
+ | * [[../CLSINIT#NoVirt| Class Construction, Destruction and Copying/No Virtual Calls in Constructor or Destructor]] | ||
* [[../FDESIGN#OneTask | FDESIGN:OneTask]] | * [[../FDESIGN#OneTask | FDESIGN:OneTask]] | ||
* [[../GEN | GEN]] – all items | * [[../GEN | GEN]] – all items |
Revision as of 16:44, 28 November 2006
Contents
Function Implementation
Issues when implementing function bodies.
Summary
ShortFunctions
Make functions short.
Consider replacing comments by function calls. Consider to flatten deep nested control structures by moving parts of them in extra functions. Consider moving complicated loop bodies into extra functions. Put repeated code snippets in an extra function.
NoMagicNumbers
Don't use unnamed constants in your code. Give them a descriptive name.
SwitchDefault
Don't just drop out of a switch statement, always provide a default case or a comment, why it is not needed.
Comment missing breaks.
NoCatchAll
Avoid catch(...).
Related Rules
- Class Construction, Destruction and Copying/No Virtual Calls in Constructor or Destructor
- FDESIGN:OneTask
- GEN – all items
- OBSOLETE:AvoidHeapAlloc
- OBSOLETE:NoOldMacros
- STL:UseAlgorithms