Difference between revisions of "Cpp Coding Standards/FIMPL"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m (Cpp Coding Standards/Topics/FIMPL moved to Cpp Coding Standards/Function Implementation: Improve Cpp_Coding_Standards structure.)
(No difference)

Revision as of 12:56, 28 November 2006

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


Explanations


Personal tools