|
|
Static objects defined in header files impose a space penalty on all object files that include those headers. If the static objects are of a type that has a constructor, they also impose a runtime penalty on all object files that include those headers. Finally, statics pollute the global namespace, raising the possibility of collision with client-defined names.
Even small penalties can add up for clients with hundreds of object files in their applications. Instead of this:
Foo.h
...
static const char x;
We have attempted, wherever possible, to do the following:
Foo.h
...
class Foo {
private:
static const char x;
...
};