Ajax said:
can not the "static const int" be replaced by "static enum" anywhere?
enum is a type, not a variable, so it needs no 'static' storage category.
'int' has an implementation-defined size, and its type is compatible with
variable ints.
'enum' is only guaranteed to have enough bits to store any value used in
their definition.
For a while, compilers could not treat 'static const int' inside a class as
a compile-time constant, and so one couldn't size arrays with it and such.
Using 'enum' as a scalar instead of a typed flag was an easy work-around.
is it necessary that define special initialization syntax for "static
const int"?
?
Constant static data are the only things that can declare inside a class.
This (I suspect) grants them their compile-time constant status.
This is all well-formed, with defined behavior:
class yo { public:
static int z (42);
};
char whatever[yo::z];
But an enum would have worked the same, too.