Rainer Deyke wrote:
On 8/31/2010 19:46, bearophile wrote:
But you can use const for constants that are known at run-time only.
While you can't use enum for constant known at run-time.

In C++, const is used for both run-time and compile-time constants.  In
practice, this works out fine.  It its value can only be known at
run-time, it's a run-time constant.  If its value is used at
compile-time, it's a compile-time constant.  If both of these apply,
it's an error.  If neither applies, nobody cares if it's a compile-time
or run-time constant.

(The actual rules in C++ are a bit more complex, less intuitive, and
less useful than that, which is presumably why Walter chose not to copy
the C++ in this case.  Still, overloading 'const' for both compile-time
and run-time constants is viable, and more intuitive than the current
situation with 'enum'.)

The enum situation exists ONLY because of linker limitations. It seems most people still don't understand that.

Reply via email to