Difference between revisions of "Cpp Coding Standards/FIMPL"
From Apache OpenOffice Wiki
m |
m |
||
Line 2: | Line 2: | ||
Issues when implementing function bodies. | Issues when implementing function bodies. | ||
---- | ---- | ||
− | === | + | === Summary === |
− | + | ||
==== ShortFunctions ==== | ==== ShortFunctions ==== | ||
Make functions short. | Make functions short. | ||
Line 26: | Line 25: | ||
* [[../OBSOLETE#NoOldMacros | OBSOLETE:NoOldMacros]] | * [[../OBSOLETE#NoOldMacros | OBSOLETE:NoOldMacros]] | ||
* [[../STL#UseAlgorithms | STL:UseAlgorithms]] | * [[../STL#UseAlgorithms | STL:UseAlgorithms]] | ||
+ | ---- | ||
+ | === Explanations === | ||
+ | |||
---- | ---- | ||
[[Category:Coding Standards]] | [[Category:Coding Standards]] |
Revision as of 18:14, 27 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(...).