> for (i = 0; i < 10; i++) {
> addr = cast(ulong)(&i) + i;
> addr = ((addr + 3) >> 2) << 2;
> printf("%d %d %d \n", i, addr, i);
> }
Can you try this?
printf("%d %lld %d \n", i, addr, i);
the 'll' tells printf about the 'long' type.
if you want to print a pointer type, use %p.
Comment #2 by bugzilla — 2007-01-29T19:23:40Z
Not a bug, a ulong needs to be printed with %llu, not %d.
Comment #3 by braddr — 2007-01-29T19:51:05Z
In general, you probably shouldn't be using printf unless there's a strong need for it. Use the more typesafe functionality provided by phobos with writef.
Comment #4 by afb — 2007-01-30T02:39:38Z
"Hello World" from DMD 1.0 uses printf. We'll be stuck with it for ages.