[Issue 15642] New: std.utf.encode should return ubyte

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 3 08:48:27 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15642

          Issue ID: 15642
           Summary: std.utf.encode should return ubyte
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: schveiguy at yahoo.com

std.utf.encode accepts at most a char[4] array, then returns a size_t to let
you know how many elements were filled.

Let's say you have a char[4] in a struct, and you want to store how much was
encoded, would you use another 12 bytes (8 for the size_t, 4 for alignment) to
store the "valid elements" in the struct to hold a number from 1 to 4?

It should be backwards compatible with any code that uses a size_t.

--


More information about the Digitalmars-d-bugs mailing list