Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site watmath.UUCP
Path: utzoo!watmath!kpmartin
From: kpmartin@watmath.UUCP (Kevin Martin)
Newsgroups: net.lang.c
Subject: Hashing to generate unique 6-char names
Message-ID: <9489@watmath.UUCP>
Date: Fri, 19-Oct-84 16:34:51 EDT
Article-I.D.: watmath.9489
Posted: Fri Oct 19 16:34:51 1984
Date-Received: Sun, 21-Oct-84 11:32:41 EDT
Organization: U of Waterloo, Ontario
Lines: 30

Unfortunately, I lost the original article. It was about 80 to 100 lines
extolling the virtues of hashing to generate a six-character identifier
from a longer one.

The article claims that the only way one can get undetected clashes is
through an incorrect program (two clashing references, but only one of the
variables actually defined). Unfortunately, correct programs can also
get undetected errors. Assume the names 'x' and 'y' happen to hash the same.
In file extern.c:
	int x = 5;
	int y = 10;

Since the two variables clash, 'y' gets re-hashed. Now, in foo.c:
	foo() {
		x = 10;
	}

and in bar.c:
	bar() {
		y = 10;
	}

Surprise! Both foo and bar assign 10 to 'x', leaving 'y' untouched.


Although hashing appears to make all the characters significant, it
actually makes all the characters partially significant in a manner that
is impossible to describe to the user. At least truncating the name to six
characters (or whatever) is an easy concept to explain.
                   Kevin Martin, UofW Software Development Group