Parallel Rogue-like benchmark
logicchains
jonathan.t.barnard at gmail.com
Fri Nov 8 00:58:38 PST 2013
That's interesting. Is there a particular reason for using size_t
for array indexing rather than int?
> uint[10] data;
> foreach (i, ref x; data)
> x = i;
>
> This code works on 32 bit systems, because the index i of an
> array is deduced as a size_t. So it fits inside the array of
> uints. On a 64 system i is still size_t, but it's now 64 bit
> long, and it can't fit. Most integral values (like int and
> uint) in D have a fixed size. While size_t is not fixed in size.
>
> This causes some problems when you want to move 32 bit code to
> a 64 bit system.
>
> Some times ago I opened an enhancement request on this topic,
> but perhaps better solutions are needed:
> https://d.puremagic.com/issues/show_bug.cgi?id=5063
More information about the Digitalmars-d
mailing list