On Tue, Mar 20, 2012 at 05:07:12PM +1100, Daniel Murphy wrote: > "H. S. Teoh" <[email protected]> wrote in message > news:[email protected]... > > Is this a bug? > > > > char[] a = "abc".dup; > > const(char)[] b = "abc"; > > string c = "abc"; > > > > writeln(typeid(a).getHash(&a)); // 12914 > > writeln(typeid(b).getHash(&b)); // 8503969683799911018 > > writeln(typeid(c).getHash(&c)); // 12914 > > > > Of course. [...]
Then the question is, what should be the fix? Currently, char[] and string have getHash defined in rt.typeinfo.ti_Ad.TypeInfo_Aa, which appears to be a custom hashing algorithm, whereas const(char)[] uses TypeInfo_Array.getHash, which uses rt.util.hash.hashOf. Which one should be used? T -- Life would be easier if I had the source code. -- YHL
