title: Static variable vs static member
body: <p>I saw this at work, and it is written by people before I joined. A static variable is used instead of static member of the class. As for now, I don't see a reason why static member of the class should not be used here. If I want to persuade people here to change it, is there any good excuse to convince them? </p>
  
  <p>I tried to find the difference between static member and static variable, seems like people are leaning toward static member shall always be used unless there is a good reason, but not very real life cases were mentioned.</p>
  
  <p><strong>Current code:</strong></p>
  
  <pre><code>class Foo {
  public:
  
     static Foo *get() {
         static Foo _instance;
  
         return &amp;_instance;
     }
  // ...
  };
  </code></pre>
  
  <p>How this function is being used:</p>
  
  <pre><code>int XXX_loadxxx(const char xxx, foo_handle *handle) {
    // just get foo ptr and return
  
    xxx::foo *ptr = xxx::foo::get();
    int ret = ptr-&gt;init();
  
    if (ret != 0) {
        return -1;
    }
    *handle = ptr;
    return 0;
  }
  </code></pre>
  
  <p>Code in my mind how the class should be defined:</p>
  
  <pre><code>class Foo {
     static Foo _instance;
  public:
        static Foo *get() {
           return &amp;_instance;
        }
  // ...
  };
  </code></pre>
  
  <p>I'd really appreciate if someone can tell me whether it makes any different to change it to static member, and why.</p>