Is this a bug?
    Jordi Sayol 
    g.sayol at yahoo.es
       
    Tue Jan 15 23:12:56 PST 2013
    
    
  
Hello,
When compiling next code to 64-bit.
app.d
----
import std.stdio;
void main()
{
	ubyte u1 = cast(byte)-1;
	byte u2 = cast(short)-1;
	uint u3 = cast(int)-1;
	int u4 = cast(long)-1;
	writefln("%d", u1);
	writefln("%d", u2);
	writefln("%d", u3);
	writefln("%d\n", u4);
	writefln("long.sizeof: %d  ulong.max: %20d", ulong.sizeof, ulong.max);
	writefln("long.sizeof: %d   long max: %20d", long.sizeof, long.max);
}
----
Prints this:
----
255
-1
4294967295
-1
long.sizeof: 8  ulong.max:           4294967295
long.sizeof: 8   long max:  9223372036854775807
----
"ulong.max" value is incorrect
Tested with dmd version 2.056, 2.057, 2.058, 2.059, 2.060 and 2.061 
No problem when compiling to 32-bit.
-- 
Jordi Sayol
    
    
More information about the Digitalmars-d-learn
mailing list