Deprecate C style declerations?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Wed Dec 20 16:54:03 PST 2006
"Bill Baxter" <dnewsgroup at billbaxter.com> wrote in message
news:emcjig$30qo$1 at digitaldaemon.com...
>
> The syntax of static multidimensional arrays is better using C-style I
> think:
>
> int[2][3][4] a; // means a[3][2][1] is max legal index
>
> int a[2][3][4]; // means a[1][2][3] is max legal index
That's true. In fact, I think there's a flag in the DMD frontend to make it
so that the D-style
int[2][3][4] a;
would have a max index of [1][2][3]. But that goes against the
right-to-left rule of declarations..
> I hope D gets real multidimensonal arrays eventually though. Then the
> need for all those brackets will go away and you'll just have:
>
> int[2,3,4] a;
Though they are two different concepts. If you need a contiguous block of
memory which can be accessed with more than one dimension, then a
rectangular array is just what you need. But for most other applications,
arrays of arrays are fine, and resizing rectangular arrays is kind of a pain
so..
More information about the Digitalmars-d
mailing list