Unique Globals Used 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
| API ID | CountGlobalsUsedUnique |
| Targets | Functions |
| Languages | C C++ Pascal Python Web |
| Categories | Coupling |
| Cost | Query |
The number of unique global objects used by this function
Example:
int my_global = 10;
void uses(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; // Duplicates do not count
} // CountGlobalsUsedUnique = 1
Compare to CountGlobalsUsed which counts all uses to global objects by this function.