Summary: getHash inconsistent for const(char)[] vs. char[] and
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime

--- Comment #0 from 2012-03-20 06:39:30 PDT ---
        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:
------- You are receiving this mail because: -------

Reply via email to