int[3][4]*
Timon Gehr
timon.gehr at gmx.ch
Fri Sep 7 20:27:21 PDT 2012
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.
More information about the Digitalmars-d-learn
mailing list