[Issue 14627] Implicit conversion from uint to dchar allows dchar > dchar.max

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Oct 24 09:13:54 PDT 2015


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

thomas.bockman at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomas.bockman at gmail.com

--- Comment #2 from thomas.bockman at gmail.com ---
The issue of dchar.max versus uint.max has been discussed on the forums:
    http://forum.dlang.org/thread/qjmikijfluaniwnxhigp@forum.dlang.org

It was decided that D compilers must support dchar values which are outside the
range of valid Unicode code points; otherwise handling encoding errors and the
like gets very awkward. Besides, actually enforcing a range less than that
which is actually representable by the binary format of dchar would be very
difficult to do in a performant way.

In light of this, I think #1 (Make dchar.max == uint.max) is the correct
solution. Allowing dchar.max to be less than its true maximum has probably
caused subtle bugs in some generic code.

The value of the maximum code point (0x10FFFF) should be moved to a separate
constant.

--


More information about the Digitalmars-d-bugs mailing list