implicite deref on array element access? (indexing)

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Feb 25 07:30:02 PST 2011


Actually that doesn't explain anything!

What I mean is, arrays in D are not the same as arrays in C.

    auto a = [1, 2, 3];
    auto pa = &a;

    writeln(&a[0]);
    writeln(&a[1]);
    writeln(&a[2]);

    writeln(&pa[0]);
    writeln(&pa[1]);
    writeln(&pa[2]);

9A2E40
9A2E44
9A2E48
12FE34
12FE3C
12FE44

Afaik D arrays have a length and then a pointer to the contents of the
array (someone correct me on this if I'm wrong?).


More information about the Digitalmars-d-learn mailing list