|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Scores can be adjusted with three different options:
See section —nesting-penalty.
See section —demi-nesting-penalty.
See section —scale.
The raw score is the number of lines or statements, whichever is greater, adjusted by a factor for the depth of the logic. Statements are nested when they are inside of a block of statements for a “block” statement (viz., “do”, “for”, “if”, “switch” or “while”). Statements within blocks used to constrain the scope of variables (not controlled by a block statement) are not multiplied by this factor.
Expressions are nested when contained within parentheses.
The cost of these is different. Block level nesting multiplies the
score for the block by the
--nesting-penalty factor (2.0 by default).
Nested expressions are multiplied by the
the square root of
--nesting-penalty by default.
Some attempt is made to judge the complexity of an expression. A complicated expression is one that contains an assignment operator, more than one relation operator, or a mixture of “and” and “or” operators with any other different kind of non-arithmetic operator. Expression scores are minimized by:
1: ((a && b) || (c && d)) 2: (a && b || c && d)
The first adds 2 to the raw score (before dividing by the scaling factor).
The latter will add 5, assuming a
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]|
This document was generated by Bruce Korb on May 15, 2011 using texi2html 1.82.