[Issue 5247] New: std.utf.stride() should not return 0xFF

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 21 01:13:36 PST 2010


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

           Summary: std.utf.stride() should not return 0xFF
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: rsinfu at gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-11-21 01:12:18 PST ---
stride(s, i) returns 0xFF, or 255, if s[i] is not a UTF-8 lead byte. This
design allows the function to silently succeed when the input is broken:

auto str = new char[](300);
str[0] = '\xFE';                // broken
str = str[str.stride(0) .. $];  // jumps 255 bytes

stride(s, i) should throw an exception if s[i] is not a lead byte. Or at least
the error value should not be 255.

-- 
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