Simple array init question

Derek Parnell derek at nomail.afraid.org
Mon Apr 9 18:07:14 PDT 2007


On Mon, 09 Apr 2007 20:38:03 -0400, Dan wrote:

>> 
>> Sorry, "int[5,5]" only compiles because of the obscure comma operator. 
> 
> According to the D spec, that should compile as a rectangular array.  I haven't tried it.  I have read the spec.
> 
> See:
> http://digitalmars.com/d/arrays.html
> and visit "Rectangular Arrays".

I don't read the spec that way at all.

"Fortunately, D static arrays, while using the same syntax, are implemented
 as a fixed rectangular layout: 
    
   double[3][3] matrix;

 declares a rectangular matrix with 3 rows and 3 columns, all contiguously
 in memory. 

 In other languages, this would be called a multidimensional array and
 be declared as: 

   double matrix[3,3];
"

To me, this is say that D uses the [3][3] syntax but *other* languages use
the [3,3] syntax.


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Justice for David Hicks!"
10/04/2007 11:03:42 AM



More information about the Digitalmars-d mailing list