Re: What is the Point of Static or Constant Variables?
Constants are also good for giving names to "magic values" as well. A "magic value" is any value that you just randomly injected into your code. For example, if you've got a set of formula values for calculating scores, and the value was 133918212, would you want to always type out 133918212 every time you needed to use that formula, or would you want to just call it SCORE_VAL?
There are differences in constant and static variables though. A constant variable usually is replaced with its value at compile time. (I haven't seen a language where this is not the case.) A static variable is not, but is constant, but its name and value are embedded in the final image of the program.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector