int[3][4]*

Timon Gehr timon.gehr at gmx.ch
Sat Sep 8 06:14:59 PDT 2012


On 09/08/2012 01:21 PM, bearophile wrote:
> 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

Wasn't aware that this got fixed. Thanks!


More information about the Digitalmars-d-learn mailing list