minow@decvax.UUCP (Martin Minow) (12/28/83)
This is a follow-on to Jerry Leichter's article on strong typing. He notes that he uses a cross-reference utility to catch misspellings (which are likely to be used only once). The first use of this technique was probably in the MAD compiler for the IBM 7090 (circa 1963). I ncorporated a test for "never written, never read, etc." when I wrote the Basic-Plus cross reference program. Also, following the lessons of the past, I added a simple test for "defined but not used" to Decus C. The algorithm is very simple: 1. When a local symbol is created, a "not_used" bit is set on. 2. When the symbol is referenced in such a way as to change its value, the not_used bit is cleared. 3. When the compiler exits the block in which the symbol was defined, it frees storage used for local symbols. If the not_used bit was on, a warning message is printed. I think the Mark Williams C compilers do the same thing. Now, on to the topic at hand... Languages such as C which require variables to be declared before they are used (and which can compile in type conversions) seem to have small, simple, compilers and run-time support environments. This makes the language widely available at the cost of a moderate amount of programmer effort. I'd hate to count the number of times I had to chase program errors in Fortran programs that were due to my belief that 'O' was an implicit integer variable. That's one historical error we don't need repeated. Martin Minow decvax!minow
preece@uicsl.UUCP (01/05/84)
#R:decvax:-31700:uicsl:6200002:000:416 uicsl!preece Jan 4 12:13:00 1984 ---------- Languages such as C which require variables to be declared before they are used (and which can compile in type conversions) seem to have small, simple, compilers and run-time support environments. This makes the language widely available at the cost of a moderate amount of programmer effort. ---------- The lack of programmer declaration in BASIC doesn't seem to have limited its availability much.