Re: Strange behavior of array

2015-10-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 16, 2015 08:37:09 Mike Parker via Digitalmars-d-learn wrote: > On Friday, 16 October 2015 at 07:25:16 UTC, Jonathan M Davis > wrote: > > > > > That does work currently, but there's talk off and on about > > deprecating the C syntax, so that may happen at some point, > > just like

Re: Strange behavior of array

2015-10-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 October 2015 at 07:25:16 UTC, Jonathan M Davis wrote: That does work currently, but there's talk off and on about deprecating the C syntax, so that may happen at some point, just like the C function pointer syntax was deprecated. Regardless, using the C array declaration synta

Re: Strange behavior of array

2015-10-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 16, 2015 04:39:57 Mike Parker via Digitalmars-d-learn wrote: > On Friday, 16 October 2015 at 03:01:12 UTC, VlasovRoman wrote: > > > Oh, thank you. Some strange solution. > > D doesn't have multidimensional built-in arrays, but rectangular > arrays. Think of it this way: > > int[3

Re: Strange behavior of array

2015-10-15 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 October 2015 at 03:01:12 UTC, VlasovRoman wrote: Oh, thank you. Some strange solution. D doesn't have multidimensional built-in arrays, but rectangular arrays. Think of it this way: int[3] a1; a1 is a static array of 3 ints. Indexing it returns an int. We can think of it lik

Re: Strange behavior of array

2015-10-15 Thread VlasovRoman via Digitalmars-d-learn
On Friday, 16 October 2015 at 02:46:03 UTC, Rikki Cattermole wrote: On 16/10/15 3:39 PM, VlasovRoman wrote: enum int m = 10; enum int n = 5; ubyte[m][n] array; for(int x = 0; x < m; x++) { for(int y = 0; y < n; y++) { array[x][y] = cast(ubyte)(x + y); } } First on the left(

Re: Strange behavior of array

2015-10-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 16/10/15 3:39 PM, VlasovRoman wrote: enum int m = 10; enum int n = 5; ubyte[m][n] array; for(int x = 0; x < m; x++) { for(int y = 0; y < n; y++) { array[x][y] = cast(ubyte)(x + y); } } First on the left(declaration), last on the right(index/assign). void main() {

Strange behavior of array

2015-10-15 Thread VlasovRoman via Digitalmars-d-learn
I get it in dmd 2.068.2 and dmd 2.069-b2. I think, that this behavior some strange: I have some code: enum int m = 10; enum int n = 5; ubyte[m][n] array; for(int x = 0; x < m; x++) { for(int y = 0; y < n; y++) { array[x][y] = cast(ubyte)(x + y); } } In r