Use constructor initializer list to initialize non-static constant members.
ISO C++03 says the following things about static data members.
[class.static.data]
9.4.2 Static data members
1 A static data member is not part of the subobjects of a class. There is only one copy of a static data member shared by all the objects of the class.`
2 The declaration of a static data member in its class definition is not a definition and may be of an incomplete type other than cv-qualified void. The definition for a staticdata member shall appear in a namespace scope enclosing the member’s class definition. In the definition at namespace scope, the name of the static data member shall be qualified by its class name using the :: operator. `
If a static data member is of const integral or const enumeration type, its declaration in the class definition can specify a constant-initializer which shall be an integral constant expression (5.19). In that case, the member can appear in integral constant expressions. The member shall still be defined in a name-space scope if it is used in the program and the namespace scope definition shall not contain an initializer*.
class A { private: const int a=9; //incorrect static const int b = 10; //declaration (correct) static const double c = 1.3 //incorrect (Only const-static int members can be initialized like that) public: A(): a(9){} }; const int A::b; //definition of const-static int member
You can take the address of a static member if (and only if) it has an out-of-class definition:
class AE { // ... public: static const int c6 = 7; static const int c7 = 31; }; const int AE::c7; // definition int f() { const int* p1 = &AE::c6; // error: c6 not an lvalue const int* p2 = &AE::c7; // ok // ... }