Re: Regarding foreach loop index ranges

2014-04-21 Thread bearophile via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=12611 Bye, bearophile

Re: Regarding foreach loop index ranges

2014-04-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On Mon, 21 Apr 2014 07:49:03 -0400, bearophile wrote: In this case I am not sure about bug reports, so I ask here. In this program the first loop doesn't compile, giving a nice error: test.d(3,5): Error: index type 'ubyte' cannot cover index range 0..300 If you comment out the first loop,

Re: Regarding foreach loop index ranges

2014-04-21 Thread bearophile via Digitalmars-d-learn
For the second loop one possible alternative behavour is to refuse a ubyte index and accept only a size_t index if it loops on a dynamic array. Another alternative is: the i variable can go from 0 to 255, then go up to the modulus of the remaining indexes, and then stop. In this program the a