Array of pointers

Ali Çehreli acehreli at yahoo.com
Mon Jan 20 13:39:20 PST 2014


On 01/20/2014 01:58 AM, Andrej Mitrovic wrote:

 > On 1/16/14, Philippe Sigaud <philippe.sigaud at gmail.com> wrote:
 >> The thing is, an array is a reference type
 >
 > Actually it's not, let's not confuse people with the terminology here.
 > To recap for people new to arrays: an array in D is really just a
 > struct, e.g.:
 >
 > struct Array
 > {
 >      int* data;
 >      size_t length;
 > }
 >
 > Array myArray;

I don't remember whether this thread explicitly excludes fixed-length 
arrays but to add to common confusion(s), the above is true only for 
slices (aka dynamic arrays). :) (And, although it shouldn't matter, the 
actual implementation defines the length member before the data member.)

Ali



More information about the Digitalmars-d-learn mailing list