Unique Globals Used/Set/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 Used/Set/Modified
API ID: CountGlobalsUsedSetModifiedUniqueLanguages: C, C++, Pascal, Python, Web
Targets: Functions
The number of unique global objects used, set, and/or modified by this function
Example:
int my_global = 10;
void combined(int x)
{
int y, z;
x ++; // Parameters do not count
if (x > 10) // Parameters do not count
x = 0; // Parameters do not count
y ++; // Locals do not count
if (y > 10) // Locals do not count
y = 0; // Locals do not count
my_global ++; // + 1 Globals count
if (my_global > 10) // Duplicates do not count
my_global= 0; // Duplicates do not count
} // CountGlobalsUsedSetModifiedUnique = 1
Compare to CountGlobalsUsedSetModified which counts all uses, sets, or modifications to global objects by this function.