Problem with object understanding and datatypes

Namal sotis22 at mail.ru
Sat May 25 11:57:21 PDT 2013


I have one more question towards using unsigned datatype

   assert(sint(-2_147_483_647) - sint(3) == sint(-2_147_483_648));
   assert(sint(-2_147_483_647) - sint(3) == sint(2_147_483_648));

Here I get an error for the second line, because it cannot be 
convertet

if i use unsigned

   assert(sint(-2_147_483_647) - sint(3) == sint(-2_147_483_648));
   assert(sint(-2_147_483_647) - sint(3) == sint(2_147_483_648u));

it makes no difference and I get an error. Why doesn't the minus 
sign matter here and how do I fix this? Especially where I have 
to use u

   assert(slong(-9_223_372_036_854_775_807) - slong(2) == 
slong(-9_223_372_036_854_775_808u));
   assert(slong(-9_223_372_036_854_775_807) - slong(2) == 
slong(9_223_372_036_854_775_808u));

Also tried this with hex numbers but it is same with them.


More information about the Digitalmars-d-learn mailing list