If at all possible, you should move away from relying on the ordering produced by a hash. This reliance is making your code needlessly fragile. Hashes are not sorting algorithms, which is why there is no ordering guarantee. In fact, it would be inappropriate to provide such a guarantee, as it would greatly constrain the implementation of improved algorithms.
-----Original Message----- From: Boris Kolpackov [mailto:[email protected]] Sent: Thu 2/4/2010 7:13 AM To: [email protected] Subject: Re: RefHashTableOfEnumerator returns me elements in differentorder for different platforms Hi Gordon, Gordon Brown <[email protected]> writes: > It is clear now that the hash function inXMLString.cpp is re-implemented. It is not really re-implemented. Rather we use XMLSize_t instead of unsigned int to hold the result. > This is causing big problems. You are the first person to mentioned this so I think it is more accurate to say it is causing problems for some applications (which, BTW, rely on something that was never explicitly guaranteed). > If I bring back the old hash function, will it cause other problems? If you patch Xerces-C++ to use unsigned int to calculate the hash value, you will get the old behavior though the hashing may not be optimal on 64-bit platforms since only 32 bit will be used. Boris -- Boris Kolpackov, Code Synthesis http://codesynthesis.com/~boris/blog Open-source XML data binding for C++ http://codesynthesis.com/products/xsd XML data binding for embedded systems http://codesynthesis.com/products/xsde Command line interface to C++ compiler http://codesynthesis.com/projects/cli
