www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3468] New: dmd allows negative values to be assigned to an uint variable

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

           Summary: dmd allows negative values to be assigned to an uint
                    variable
           Product: D
           Version: 1.050
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: qian.xu funkwerk-itk.com



---
Description: "uint i = -1" is allowed by dmd 1.050. 
Expectation: A warning or an error should be shown by compiling the code.

I misspelled int as uint. A boolean expression (if i < 0) always equals false.
It took me long time to debug my code. Finally I have found out, that the value
i is not -1.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3468


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
           Severity|normal                      |enhancement



16:08:08 PST ---
I'll put this as an enhancement request because negate is currently an
operation that is defined to work on unsigned values, hence no error.

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