This document provides language-specific details about the file metrics for the C++ programming language.
The "complexity" metric counts:
if
andelse if
statements- Uses of the conditional operator
condition ? then : otherwise
- Loops, including
for
loopswhile
loopsdo-while
loops- range-based
for
loops, likefor ( optional-init-statement; int& i : some_vector )
- Logical binary operators
&&
and||
, as well as their alternative representationsand
andor
case
labels in switch-statementscatch
blocks- Structured Exception Handling (SEH)
__except
clauses - Function declarations, exactly like they are considered for the "functions" metric
It does not count:
- Any function calls, including calls of standard library functions for a more functional programming style, like
std::for_each
- Any preprocessor directives, including
#if
,#ifdef
and#elif
- Bitwise binary operators, like
^
(xor
),&
(bitand
),|
(bitor
),&=
(and_eq
) or|=
(or_eq
)
The "functions" metric counts function declarations in both header and source files. This also includes the definition of functions in source or header files that were already declared before. The metric is tested to account for:
- general functions
- member functions, including constructors, destructors, (pure) virtual functions, default functions and deleted functions
- lambda expressions
The "classes" metric counts:
- class declarations
- struct declarations
- union declarations
- enum declarations (including scoped enums, unscoped enums and opaque enums)
It also considers declarations that are inside a typedef
, like typedef struct { int a; } alias_name;
It does not count:
- forward declarations of classes, structs and unions (with semicolon directly after the class/struct/enum name instead of a code block, like
class name;
). - General type definitions via
typedef
There are no language-specific details for these metrics. See README.md for their general definition.