[Issue 9331] New: incorrect "ulong.max" value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 16 23:52:57 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9331
Summary: incorrect "ulong.max" value
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: g.sayol at yahoo.es
--- Comment #0 from Jordi Sayol <g.sayol at yahoo.es> 2013-01-16 23:52:53 PST ---
When compiling this 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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list