scitools.com

← Metric catalog

Globals Set 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.

Globals Set

API ID: CountGlobalsSet
Languages: C, C++, Pascal, Python, Web
Targets: Functions

The number of times this function sets global objects

Example:

    int my_global = 10;
    void sets(int x)
    {
      int y, z;
      x = 1;           //     Parameters do not count
      x = 2;           //     Parameters do not count
      y = 1;           //     Locals do not count
      y = 2;           //     Locals do not count
      my_global = 1;   // + 1 Globals count
      my_global = 2;   // + 1 Duplicates count
    }                  // CountGlobalsSet = 2
    

Compare to CountGlobalsSetUnique which counts unique global objects this function sets.