[Issue 10221] New: foreach(char c; 0..256) doesn't work even though the upper bound is 255

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 31 16:32:56 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10221

           Summary: foreach(char c; 0..256) doesn't work even though the
                    upper bound is 255
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thelastmammoth at gmail.com


--- Comment #0 from thelastmammoth at gmail.com 2013-05-31 16:32:55 PDT ---
foreach(char c; 0..256) doesn't work even though the upper bound is 255:
Error: cannot implicitly convert expression (256) of type int to char

Maybe instead disallow: foreach(char c; 0..257) ?

Is that a bug, or how would we achieve iterating over all chars without
resorting to :
foreach(c_; 0..256){
char c=c_.to!char;
}

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


More information about the Digitalmars-d-bugs mailing list