I was rereading the Integer Literals section and trying out some code
when I came across a couple of error messages on integer overflows.

I have reproduced the code below for reference.

void main()
{
    // The maximum long value is ...807
    // The following line produces an error message:
    // Error: signed integer overflow
    auto a = 9_223_372_036_854_775_808;

    // The maximum ulong value is ...615
    // The following line produces an error message:
    // Error: integer overflow
    auto g = 18_446_744_073_709_551_616U;
}

I just wanted to point out that the second error message might be
consistent if it says 'Error: unsigned integer overflow' in
comparison to the first error message.

Also, I noticed under the Integer Literal section of the D reference
document (http://dlang.org/spec/lex.html) that the range of uint

  0U .. 4_294_967_296U

in the table Decimal Literal Types has a typo. Shouldn't the range
end with 4_294_967_295U?

Here's a snippet:

import std.stdio;
void main()
{
    writeln(typeof(4_294_967_295U).stringof);
    writeln(typeof(4_294_967_296U).stringof);
}

Reply via email to