scitools.com

← Metric catalog

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: CountLineInactive
Languages: 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.


Targets By Language: Configuration: