[Issue 13606] erroneous overflow error in negative long literal

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Oct 12 08:35:40 PDT 2014


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

--- Comment #4 from bearophile_hugs at eml.cc ---
(In reply to Ketmar Dark from comment #3)

> by the way: it it correct to accept negative literals with "u" and "uL"? i'm
> thing that such literals should be rejected with "overflow" (or "underflow")
> error.

I think they should be rejected by a modern and sanely designed language.
Trying to convince Walter of this is hard.

Currently D accepts assignments from signed without errors or warnings, this is
an example of "weak typing" in D:

void main() {
    ubyte x1;
    byte y1;
    x1 = y1;
    y1 = x1;
    ushort x2;
    short y2;
    x2 = y2;
    y2 = x2;
    uint x3;
    int y3;
    x3 = y3;
    y3 = x3;
    ulong x4;
    long y4;
    x4 = y4;
    y4 = x4;
}

--


More information about the Digitalmars-d-bugs mailing list