Spinoza hat geschrieben:Wer kommt denn darauf, static int-definitionen zuzulassen aber doubles nicht. Stroustrup ist ein Narr... aber das war mir bereits bekannt.
Das ist doch nicht Stroustrup allein! Hinter dem Standard sitzt ein risiges Kommitee, darunter auch "Abgesandte" der großen Compilerbauer, die auch ein Wörtchen mitzureden haben. Und die Leute wissen schon, was sie tun.
Der C++03 sagt explizit:
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).
Und jetzt ein Blick in den
aktuellen C++-Standard (=C++11):
9.4.2:
3
If a static data member is of const literal type, its declaration in the class definition can specify a brace-or-
equal-initializer in which every initializer-clause that is an assignment-expression is a constant expression.
A static data member of literal type can be declared in the class definition with the constexpr specifier;
if so, its declaration shall specify a brace-or-equal-initializer in which every initializer-clause that is an
assignment-expression is a constant expression. [ Note: In both these cases, the member may appear in
constant expressions. — end note ] The member shall still be defined in a namespace scope if it is odr-
used (3.2) in the program and the namespace scope definition shall not contain an initializer.
§2.14 (Literals)
The type of a floating literal is double unless explicitly specified by a suffix. The suffixes f and F specify
float, the suffixes l and L specify long double. If the scaled value is not in the range of representable
values for its type, the program is ill-formed.
Das heißt, mit C++11 ist dein Programm absolut Standard-konform, mit C++03 leider nicht
Pass aber mit der odr (One definition rule) auf; ein "const double d;" in deiner .cpp sollte reichen.