Re: Iterating over 0..T.max

2011-03-10 Thread Magnus Lie Hetland
On 2011-03-09 21:24:57 +0100, Kai Meyer said: I don't see how that works in dmd2, and I don't have much experience with dmd1, so I'll admit that this may be different on dmd1. Derp. I didn't mean bool -- I was talking about byte. (Which should make quite a bit more sense, given that I'm

Re: Iterating over 0..T.max

2011-03-10 Thread bearophile
Magnus Lie Hetland: Derp. I didn't mean bool -- I was talking about byte. (Which should make quite a bit more sense, given that I'm talking about a limit of 256... :D) Please show a complete minimal program that gives you problem. (I have failed to reproduce your problem on Windows). Bye,

Re: Iterating over 0..T.max

2011-03-10 Thread Steven Schveighoffer
On Thu, 10 Mar 2011 07:50:21 -0500, bearophile bearophileh...@lycos.com wrote: Magnus Lie Hetland: Derp. I didn't mean bool -- I was talking about byte. (Which should make quite a bit more sense, given that I'm talking about a limit of 256... :D) Please show a complete minimal program

Re: Iterating over 0..T.max

2011-03-10 Thread bearophile
Steven Schveighoffer: void main() { auto a = new ubyte[256]; foreach(ubyte i, ref e; a) e = i; } http://d.puremagic.com/issues/show_bug.cgi?id=5725 Bye, bearophile

Iterating over 0..T.max

2011-03-09 Thread Magnus Lie Hetland
In a (template) data structure I'm working on, I had the following thinko: auto a = new T[n]; foreach (T i, ref e; a) { e = i; } Then I instantiated it with T=bool, and n=256. Infinite loop, of course -- the problem being that i wraps around to 0 after the last iteration.

Re: Iterating over 0..T.max

2011-03-09 Thread Kai Meyer
On 03/09/2011 09:09 AM, Magnus Lie Hetland wrote: In a (template) data structure I'm working on, I had the following thinko: auto a = new T[n]; foreach (T i, ref e; a) { e = i; } Then I instantiated it with T=bool, and n=256. Infinite loop, of course -- the problem being that i wraps around to