Libraries and exporting static variables in C++
<p>Imagine i have such library:</p>

<p>Library.h</p>

<pre><code>   class DLLEXPORT LibraryClass
    {
    private:
      int _id;
      static int _last_id;
    public:
      LibraryClass();
      bool operator == (const LibraryClass t)
      {return _id == t._id;}
    };
</code></pre>

<p>Library.cpp </p>

<pre><code>#include "Library.h"

int LibraryClass::_last_id = 0;

LibraryClass::LibraryClass()
_id(_last_id)
{
++_last_id;
}
</code></pre>

<p>Will it work correct? I'm getting C4835 warning in Visual Studio, but seems it works. Does anybody know how it will work on other compilers (i'm interested in linux gcc and mac gcc)? Is there another "valid" implementation for such pattern?</p>
