Bug 15642 – std.utf.encode should return ubyte

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-02-03T16:48:27Z
Last change time
2024-12-01T16:25:55Z
Keywords
trivial
Assigned to
No Owner
Creator
Steven Schveighoffer
Moved to GitHub: phobos#10157 →

Comments

Comment #0 by schveiguy — 2016-02-03T16:48:27Z
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.
Comment #1 by schveiguy — 2017-03-31T23:15:33Z
There was an attempt to fix this, but it died in committee. https://github.com/dlang/phobos/pull/5077
Comment #2 by robert.schadek — 2024-12-01T16:25:55Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10157 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB