Difference between revisions of "Cpp Coding Standards/FIMPL"
From Apache OpenOffice Wiki
m |
|||
Line 33: | Line 33: | ||
* [[../Function Design#OneTask | FDESIGN:OneTask]] - One Task | * [[../Function Design#OneTask | FDESIGN:OneTask]] - One Task | ||
* [[../General Coding |GEN]] – all items | * [[../General Coding |GEN]] – all items | ||
− | * [[../Obsolete Habits# | + | * [[../Obsolete Habits#Stack |OBSOLETE:Stack]] - Prefer Allocation from Stack |
− | * [[../Obsolete Habits# | + | * [[../Obsolete Habits#NoMacro |OBSOLETE:NoMacro]] - No Old Macros |
− | * [[../STL# | + | * [[../STL#Algo |STL:Algo]] - Prefer the STL Algorithms |
---- | ---- | ||
[[Category:Coding Standards]] | [[Category:Coding Standards]] |
Revision as of 23:34, 29 November 2006
Topic-Id: FIMPL
Issues when implementing function bodies.
Contents
Summary
Short Functions (Short)
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.
No Magic Numbers (MagNum)
Don't use unnamed constants in your code. Give them a descriptive name.
Default in switch Statements (DefSwitch)
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.
No Catch All (Catch)
Avoid catch(...).
Related Rules
- CLSINIT:NoVirt - No Virtual Calls in Constructor or Destructor
- FDESIGN:OneTask - One Task
- GEN – all items
- OBSOLETE:Stack - Prefer Allocation from Stack
- OBSOLETE:NoMacro - No Old Macros
- STL:Algo - Prefer the STL Algorithms