Dynamic array initialization syntax

bearophile bearophileHUGS at lycos.com
Wed Feb 16 16:30:40 PST 2011


I have suggested a simple initialization syntax for dynamic arrays, similar to the syntax used for fixed-sized arrays:
http://d.puremagic.com/issues/show_bug.cgi?id=5603

void main() {
    auto a2 = new int[5] = void;
    auto a1 = new int[5] = 1;
    auto m2 = new int[][](5, 5) = void;
    auto m1 = new int[][](5, 5) = 1;
}

Surely I am not the first person to suggest this :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list