dmt@mtgzz.UUCP (d.m.tutelman) (08/16/85)
Turbo Pascal "constants" really aren't. Of course, you knew that! The manual clearly states that they're really 'initialized variables'. Well, not quite! They're really storage with a value at COMPILE TIME. The difference is best shown by three examples: 1- If you declare a "const" in a procedure, and modify it in the procedure, the next time through the procedure you'll find the MODIFIED value, not the declared value. 2- If a program terminates and you immediately re-run (without recompiling), you'll find the MODIFIED values from the last run. 3- Suppose you've been running the program, like the way it works, and decide to "compile" it to a .COM file. The .COM file is made from the core image, which now has the "const" values left over from the last run. If you now quit and run the .COM program, you'll find the leftover values from your last run under TURBO. Every time! "Const" is still a useful construct, but it ain't all it's cracked up to be. In particular, use it as a constant, but don't use it as an initialized variable without code to reinitialize it each time through. Disclaimer: I still think Turbo Pascal is the best bargain on the software market, and will continue to love it for developing programs under 1000 lines. Dave Tutelman Physical - AT&T Information Systems Holmdel, NJ 07733 Logical - ...ihnp4!mtuxo!mtgzz!dmt Audible - (201)-834-2895