Strange behavior of array

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 16 01:37:09 PDT 2015


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 syntax is generally 
> discouraged - though the fact that the D syntax for static 
> arrays is basically the reverse of what folks expect (much as 
> it makes perfect sense from the compiler's point of view with 
> how types are put together) definitely does make things 
> confusing.
>

I'm not talking about using C array declaration syntax in D. I'm 
just saying that the indexes in the declaration should be 
reversed. Perhaps I should be more explicit.

int foo[rows][columns];     // In C
int[columns][rows] foo;     // In D



More information about the Digitalmars-d-learn mailing list