Re: Pointer to Struct Pointer

2011-02-19 Thread oliver
== Quote from Stewart Gordon (smjg_1...@yahoo.com)'s article > On 19/02/2011 13:18, Oliver wrote: > > > > Hello, > > > > I have the following code that works. > What? The code you've posted doesn't work. Sorry for that, in the post I got the // and the second one mixed up. > > I'd like to change

Re: Pointer to Struct Pointer

2011-02-19 Thread Oliver
== Quote from bearophile (bearophileh...@lycos.com)'s article > Oliver: > > ... > struct Ts { > int d; > union { > int[] intData; > double[] doubleData; > } > } > struct Rs { > int i; > union { > int intData; > Ts* tsData; > } > this(int i

Re: Pointer to Struct Pointer

2011-02-19 Thread Stewart Gordon
On 19/02/2011 13:18, Oliver wrote: Hello, I have the following code that works. What? The code you've posted doesn't work. I'd like to change the t tsData to ts tsData, but this does segfault. The code you've posted throws an AV, and correctly so. If you change tsData to a ts, it runs

Re: Pointer to Struct Pointer

2011-02-19 Thread bearophile
Oliver: > ... struct Ts { int d; union { int[] intData; double[] doubleData; } } struct Rs { int i; union { int intData; Ts* tsData; } this(int i, int d, int[] data) { this.i = i; this.tsData = new typeof(*tsData)

Pointer to Struct Pointer

2011-02-19 Thread Oliver
Hello, I have the following code that works. I'd like to change the t tsData to ts tsData, but this does segfault. I do not understand how I dereferece the ts struct correctly. Perhaps someone could give me a hint. Thanks. Oliver - alias rs *r; alias ts *t; struct ts { int