Inactive Lines 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.
Inactive Lines
API ID: CountLineInactiveLanguages: C#, C++, Pascal
Targets: Architectures, Classes, Files, Functions, Modules, Project, Subprograms
Number of inactive lines.
This is the number of lines that are inactive from the view of the preprocessor. In other words, they are on the FALSE side of a #if or #ifdef preprocessor directive.
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 blank line and the cout << "Inactive Line" statement between #ifdef A_VERY_NICE_VARIABLE and #endif (lines 22 and 23) are both inactive, since A_VERY_NICE_VARIABLE isn't defined, giving CountLineInactive = 2. The #ifdef and #endif directive lines themselves are always considered active, so they count towards Preprocessor Lines instead of here.
See Code Lines, Comment Lines, and Blank Lines (Includes Inactive) to count what's inside inactive regions by category.
- C#: Project, File, Class, Method
- C++: Project, File, Class, Struct, Union, Function
- Pascal: Project, File, Class, Interface, Compunit, Function, Procedure
- This metric can be disabled from "Project Configuration/Metrics/Lines and Statements" with the "Show line count metrics" option.
- For projects and architectures, this metric is enabled from "Project Configuration/Metrics/Projects and Architectures" with the "Show default summary metrics" option.