www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3355] New: std.string.cmp works incorrectly for mixed-type and different-length strings

reply d-bugmail puremagic.com writes:
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



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: -------
Oct 01 2009
next sibling parent d-bugmail puremagic.com writes:
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: -------
Oct 01 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jun 14 2010
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Aug 11 2010