[Mono-devel-list] GetHashCode () differences from Microsoft

Dennis Hayes DENNISH at Raytek.com
Wed Jun 4 19:55:43 EDT 2003


First, Mono (seems to me) is more conservative than GNU.Net about looking at
the rotor code, so just because it is on in GNU.Net, does not make it ok in
Mono.

Second, the question of how to get correct hash codes is tricky.
There was a similar problem with values for enums, where the name of the
enum is documented, but its value is not.
We get enum values from dll compare utilities or our tool (enumcheck) that
list enum values given an assembly/namespace/enum.

Are there cases where we can figure out how the GetHashCode() value is
calculated? For instance, the hash value for an int is just the int (I
think). Other hash values may just be values of members multiplied together
(is the hash value for point just gethashcode(point.x) *
gethashcode(point.y) (with overflow turned off)?)

Third, differences with the MS version of hash codes is not really "wrong."
Gethashcode() is meant to only be used to hashes more efficient. Worst case,
this should only make hash table lookups slower/faster.

Third and a half, hash codes are suppose to be implementation details. Why
would a test program (MS or ours) ever look at these?

I have only work with winforms. Are enum values given for enums in the ECMA
classes? 
Are hash codes algorithms included in the ECMA spec?

Dennis






More information about the Mono-devel-list mailing list