Problem with object understanding and datatypes

Ali Çehreli acehreli at yahoo.com
Sat May 25 07:35:02 PDT 2013


On 05/25/2013 04:34 AM, Namal wrote:

 >      assert(slong(9_223_372_036_854_775_806) + slong(-3) ==
 > slong(-9_223_372_036_854_775_808));
 > }
 >
 > The first test is ok, but second wont even compile. Even if I append a L
 > to each number.

According to the "Integer Literals" section here:

   http://dlang.org/lex.html

Decimal literals are resolved as either int or long. 
9_223_372_036_854_775_808 cannot fit either of those types.  If you want 
ulong, you must either write the literal in hexadecimal or binary format 
or provide the UL suffix.

Ali



More information about the Digitalmars-d-learn mailing list