On 09/08/2012 04:19 AM, bearophile wrote:
Ellery Newcomer:

alright what's the deal?

This is one of the "clean" ways to do it:

void main () {
     static struct Mat {
         int[3][4] m;
         alias m this;
     }
     Mat* fooz = new Mat;
     fooz[1][3] = 5;

This may corrupt your heap.

}


Bye,
bearophile

I prefer this:

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

But I think the original example should just work.

Reply via email to