Rectangular Arrays

Bill Baxter dnewsgroup at billbaxter.com
Fri Feb 23 10:23:27 PST 2007


mike wrote:
> Am 23.02.2007, 07:37 Uhr, schrieb Bill Baxter <dnewsgroup at billbaxter.com>:
> 
>> D doesn't have rectangular arrays at the moment.  But you can init a 
>> multi-dim ragged array.
>>
>> http://www.digitalmars.com/d/expression.html#NewExpression
>>
>> int[][][] bar = new int[][][](5,20,30);
>> or
>> auto bar = new int[][][](5,20,30);
>>
> 
> That's interesting ... I use two-dim arrays, like
> 
> ' byte[bufferCount][bufferLength]
> 
> and didn't even know this syntax, but apparently it works. Need to take 
> a look at what exactly I did, I can't remember and don't have my code on 
> this machine here.

Static arrays work that way.
    byte[bufferCount][bufferLength] foo;

as long as bufferCount and bufferLength are compile-time constants.

--bb


More information about the Digitalmars-d-learn mailing list