A better language

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Apr 17 13:17:58 PDT 2006


"renox" <renosky at free.fr> wrote in message 
news:e20n8n$cia$1 at digitaldaemon.com...
> I know that and for me, this is an unpleasant pitfall of D, especially for 
> array declaration:
> int[Y][X] t; and then t[x][y] = ...

I find it a lot easier to think of multi-dimensional arrays as if they had 
parentheses to show binding of types, like so:

(int[Y])[X] t;

That is, t is an array of size [X] of (arrays of size[Y] of int).  That is, 
when you use one level of [] operators,

t[4]

You get an int[Y].  Then you use another set to strip off the [Y] to get at 
the actual int values. 





More information about the Digitalmars-d mailing list