Thread overview
[Issue 3355] New: std.string.cmp works incorrectly for mixed-type and different-length strings
Oct 01, 2009
Ali Cehreli
October 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3355

           Summary: std.string.cmp works incorrectly for mixed-type and
                    different-length strings
           Product: D
           Version: 2.032
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: acehreli@yahoo.com


--- Comment #0 from Ali Cehreli <acehreli@yahoo.com> 2009-10-01 01:08:40 PDT ---
cmp fails unit tests when added this one

    result = cmp("aa", "aaa"d);
    assert(result < 0);


The patch is trivial:

109c109
<             if (i1 == s1.length) return s2.length - i2;
---
>             if (i1 == s1.length) return i2 - s2.length;
136a137,143
> 
>     result = cmp("aa", "aaa"d);
>     assert(result < 0);
>     result = cmp("aaa", "aa"d);
>     assert(result > 0);
>     result = cmp("aa", "aa"d);
>     assert(result == 0);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3355


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3355


Lars T. Kyllingstad <bugzilla@kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@kyllingen.net
         AssignedTo|andrei@metalanguage.com     |bugzilla@kyllingen.net


--- Comment #1 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-06-14 07:10:22 PDT ---
http://www.dsource.org/projects/phobos/changeset/1641

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 11, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3355


Lars T. Kyllingstad <bugzilla@kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-08-11 02:43:04 PDT ---
Fixed DMD 2.048

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------