scitools.com

← Metric catalog

Uses/Sets/Modifies 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.

Uses/Sets/Modifies

API ID: CountUseSetModify
Languages: Any
Targets: Objects

The number of times this object is used, set, and/or modified

Example:

    int a_global = 0;      // + 1 set reference
    void function1() {
      a_global += 1;       // + 1 modify reference
      if (a_global > 1)    // + 1 use reference
        a_global = 0;      // + 1 set reference
    }
    void function2() {
      a_global -= 1;       // + 1 modify reference
      a_global -= 1;       // + 1 modify reference
      if (a_global < 0)    // + 1 use reference
        a_global = 0;      // + 1 set reference
      if (a_global > 10)   // + 1 use reference
        a_global = 10;     // + 1 set reference
    }
                           // CountUseSetModify = 10
    

Compare to CountUseSetModifyUnique which counts unique entities that use, set, or modify this object.