scitools.com

← Metric catalog

Unique Globals Modified 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.

Unique Globals Modified

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

The number of unique global objects modified by this function

Example:

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

Compare to CountGlobalsModified which counts all modifications to global objects by this function.