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.

Reply via email to