Is empty array null?

bearophile bearophileHUGS at lycos.com
Mon Mar 5 17:00:12 PST 2012


Steven Schveighoffer:

> D makes arrays as safe as possible, and as useful as possible.  The  
> pointer value itself is an implementation detail, and should rarely be  
> used to determine logic.

D array design also leads to some traps, like forgetting to use "ref" here:

void append5andMore(int[] a) {
    a ~= 5;
    a.length++;
}


I have had some of such bugs in my D code.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list