Trying to understand multidimensional arrays in D
Ali Çehreli
acehreli at yahoo.com
Tue Dec 22 16:56:18 UTC 2020
On 12/22/20 6:35 AM, ag0aep6g wrote:
> Flip the pointer syntax, too:
>
> *Foo a; /* a pointer to a Foo */
I am not a language expert but I think that would make D's parsing
complicated (like C++'s < token) because * already means "derefence" in
that position. So, the parser would see *Foo as a potential compilation
error but would have to parse forward, etc.
> [4]Foo b; /* an array of four Foos */
[4] already has a meaning. ;)
> [][4]Foo c; /* a dynamic array of arrays of four Foos each */
I've just learned that the type of [] is void[]. Huh...
> But now we're no longer C-like, I guess.x
Ali
More information about the Digitalmars-d-learn
mailing list