Re: little question once again
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 26, 1999
- 655 views
On Sun, 26 Sep 1999, you wrote: > On Sat, 25 Sep 1999 22:37:06 -0400, Irv Mullins <irv at ELLIJAY.COM> wrote: > >constant pi = 3.0 -- that's wrong, but I can change it! > > > That is true in Euphoria because Euphoria doesn't have real constants. Bzzt! Sorry, that's the wrong answer. Euphoria will halt with this error message: may not change the value of a constant pi = 3 > In C or C++ when you try to change a constant's value you will get a > run-time error. In C++ you can only explicitly override the constant by > using the const_cast operator. Bzzt! again. (sort of) The whole purpose of constants is that they cannot be programatically changed. A C++ constant is just a variable that's "hard" to change. Pascal (Borland flavor) lets you change the value of constants even easier, but at least the documentation says to thinkof them as "initialized variables". Irv