Code Lines (Includes Inactive) is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Code Lines (Includes Inactive)
| API ID | CountLineCodeWithInactive |
| Targets | Architectures Classes Files Functions Project |
| Languages | C++ |
| Categories | Lines |
| Cost | Lookup |
| Tags | With Inactive Lines |
Number of lines containing source code, including inactive regions.
Unlike Code Lines, this counts a code line whether or not it falls inside an inactive #if/#ifdef region, and also counts the preprocessor conditional directive lines (#ifdef, #endif, etc.) that guard those regions.
For example:
void SayHello::printHello() {
switch (i) {
case 0:
cout << "Hello World" << endl;
case 1:
cout << "HELLO WORLD!" << endl;
default: // a comment here
for (int m = 0; m < j; m++);
cout << "hello world" << endl;
}
#ifdef A_VERY_NICE_VARIABLE
cout << "Inactive Line" << endl; // Inactive
#endif
}
The 12 code lines (11-20, 23, 26 — including the inactive cout << "Inactive Line" statement) plus the 2 preprocessor lines (#ifdef A_VERY_NICE_VARIABLE and #endif) give CountLineCodeWithInactive = 14.
See Code Lines to exclude inactive code.
- C++: Project, File, Class, Struct, Union, Function