www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3280] New: comparing array length is wonky

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3280

           Summary: comparing array length is wonky
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ellery-newcomer utulsa.edu


void main(){
    string s;
    int a = s.length;
    assert(a == 0);
    assert(s.length == 0);
    assert(a == 0);
    assert(a > -1);
    assert(s.length > -1); //fails
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 01 2009
next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3280


Jarrett Billingsley <jarrett.billingsley gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jarrett.billingsley gmail.c
                   |                            |om





2009-09-01 17:09:24 PDT ---
Sorry, invalid. typeof(s.length) is unsigned, typeof(-1) is signed. The
compiler should throw an error on the last assert, but doesn't. Instead, it
casts -1 to size_t, resulting in something like "assert(s.length >
0xFFFFFFFF);" See bug 259.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 01 2009
parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
d-bugmail puremagic.com wrote:
 See bug 259.
 
Oh, gosh. I need multiple votes.
Sep 01 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3280


Jarrett Billingsley <jarrett.billingsley gmail.com> changed:

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





2009-09-01 17:09:39 PDT ---
Oops

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