scitools.com

← Metric catalog

Empty Statements 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.

Empty Statements

API ID: CountStmtEmpty
Languages: C++
Targets: Architectures, Classes, Files, Functions, Project

Number of empty statements.

An empty statement is a lone ; with no expression, most often the trailing semicolon of an otherwise-empty loop body.

For example:


int main() {
  for (int i = 0;
       i < 10;
       i++)
    ;

  int j = func();
  int k = 0;
  int l = 1;

  int m
    = func();
  int n;
  n = 1;

#ifdef A_VERY_NICE_VARIABLE

  int j = 0;
  cout << j << endl;
#endif

  return 0;
}

The for loop's body is just ; (line 64) — a placeholder, since the loop's real work happens in its header — for CountStmtEmpty = 1.

See Statements for the total statement count this is part of.


Targets By Language: Configuration: