int[3][4]*

bearophile bearophileHUGS at lycos.com
Sat Sep 8 04:21:02 PDT 2012


Timon Gehr:

> This may corrupt your heap.

I usually don't put the alis this...


> I prefer this:
>
> void main(){
>     alias int[3][4] fooz;
>     int[3][4]* i = (new fooz[1]).ptr;
> }

This allocates past the size of the array, the information to 
append to the array of fooz. It's a very little amount of memory.

Since some weeks, if you allocate a single struct that contains a 
single fixed size array, that memory is not allocated.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list