www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15642] New: std.utf.encode should return ubyte


          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 puremagic.com
          Reporter: schveiguy 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.

Feb 03 2016