← Back to index
|
Original Bugzilla link
Bug 3355 – std.string.cmp works incorrectly for mixed-type and different-length strings
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-10-01T01:08:00Z
Last change time
2015-06-09T01:26:47Z
Keywords
patch
Assigned to
bugzilla
Creator
acehreli
Comments
Comment #0
by acehreli — 2009-10-01T01:08:40Z
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);
Comment #1
by bugzilla — 2010-06-14T07:10:22Z
http://www.dsource.org/projects/phobos/changeset/1641
Comment #2
by bugzilla — 2010-08-11T02:43:04Z
Fixed DMD 2.048