Strange that D is printing large values as zero. Any mistake in my code?

Sparsh Mittal sparsh0mittal at gmail.com
Thu Feb 14 07:44:23 PST 2013


Here is the program:


import std.stdio;

const long DIM = 1024*1024*1024*1024*4;
void main()
{
writeln(" DIM  is ", DIM);
writeln(" Value ", 1024*1024*1024*1024*4);
writeln(" Max ", long.max);

}

I compiled it:
gdc -frelease -O3 temp.d -o t1 ; ./t1
  DIM  is 0
  Value 0
  Max 9223372036854775807

Can you please tell, why it is taking DIM as zero? If I reduce 
DIM, it works fine. It is strange.


More information about the Digitalmars-d-learn mailing list