digitalmars.D.bugs - [Issue 7741] New: getHash inconsistent for const(char)[] vs. char[] and string
- d-bugmail puremagic.com Mar 20 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7741 Summary: getHash inconsistent for const(char)[] vs. char[] and string Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: druntime AssignedTo: nobody puremagic.com ReportedBy: hsteoh quickfur.ath.cx --- Comment #0 from hsteoh quickfur.ath.cx 2012-03-20 06:39:30 PDT --- Code: 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 It appears that char[] and string (==immutable(char)[]) have getHash implemented in rt.typeinfo.ti_Ad.TypeInfo_Aa, which has its own hashing algorithm, whereas const(char)[] just uses object.TypeInfo_Array.getHash, which calls rt.util.hash.hashOf. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 20 2012








d-bugmail puremagic.com