The Case For Autodecode
ag0aep6g via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jun 3 11:55:37 PDT 2016
On 06/03/2016 08:36 PM, Steven Schveighoffer wrote:
> but a direct cast
> of the bits from char does NOT mean the same thing as a dchar.
That gives me an idea. A bitwise reinterpretation of int to float is
nonsensical, too. Yet int implicitly converts to float and (for small
values) preserves the meaning. I mean, implicit conversion doesn't have
to mean bitwise reinterpretation.
How about replacing non-standalone code units with replacement character
(U+FFFD) in implicit widening conversions?
For example:
----
char c = "รถ"[0];
wchar w = c;
assert(w == '\uFFFD');
----
Would probably just be band-aid, though.
More information about the Digitalmars-d
mailing list