Trying to understand multidimensional arrays in D

Rekel paultjeadriaanse at gmail.com
Tue Dec 22 15:24:04 UTC 2020


On Tuesday, 22 December 2020 at 14:15:12 UTC, Mike Parker wrote:
> [][4]Foo is completely backwards from and inconsistent with the 
> pointer declaration syntax. We shouldn't want to intentionally 
> introduce inconsistencies.

The way C syntax handles pointers isn't very consistent to begin 
with imo.
It's strange & and * are prepended to pointer variables for 
example, while indexing is postpended. Leads to stuff like;
> (*array_of_pointers_to_arrays[2])[1]
vs
> array_of_pointers_to_arrays[2]*[1]

and

> (*array_of_pointers[1]).x'
vs
> 'array_of_pointers[1]*.x'

On Tuesday, 22 December 2020 at 14:35:30 UTC, ag0aep6g wrote:
> But now we're no longer C-like, I guess.

I think it'd still be quite C-like, same concepts samilar usage.
You're not using 'int foo[]' syntax anymore anyhow.


More information about the Digitalmars-d-learn mailing list