March 20, 2012 [Issue 7741] New: getHash inconsistent for const(char)[] vs. char[] and string | ||||
---|---|---|---|---|
| ||||
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: ------- |
August 17, 2013 [Issue 7741] getHash inconsistent for const(char)[] vs. char[] and string | ||||
---|---|---|---|---|
| ||||
Posted in reply to hsteoh@quickfur.ath.cx | http://d.puremagic.com/issues/show_bug.cgi?id=7741 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #1 from hsteoh@quickfur.ath.cx 2013-08-17 12:06:02 PDT --- Fixed in git HEAD. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation