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
That's interesting. Is there a particular reason for using size_t
for array indexing rather than int?
- Re: Parallel Rogue-like benchmark bearophile
- Re: Parallel Rogue-like benchmark Daniel Davidson
- Re: Parallel Rogue-like benchmark Marco Leise
- Re: Parallel Rogue-like benchmark Dmitry Olshansky
- Re: Parallel Rogue-like benchmark bearophile
- Re: Parallel Rogue-like benchmark Dicebot
- Re: Parallel Rogue-like benchmark Joseph Rushton Wakeling
- Re: Parallel Rogue-like benchmark bearophile
- Re: Parallel Rogue-like benchmark logicchains
- Re: Parallel Rogue-like benchmark bearophile
- Re: Parallel Rogue-like benchmark logicchains
- Re: Parallel Rogue-like benchmark Marco Leise
- Re: Parallel Rogue-like benc... Dicebot
- Re: Parallel Rogue-like benc... logicchains
- Re: Parallel Rogue-like ... bearophile
- Re: Parallel Rogue-like ... logicchains
- Re: Parallel Rogue-like ... bearophile
- Re: Parallel Rogue-like ... John Colvin
- Re: Parallel Rogue-like benchmark Joseph Rushton Wakeling
