digitalmars.D.learn - Struct initialization syntax
- Azi Hassan (4/4) Jan 17 2018 The D tour for structs uses a syntax similar to that of C++ in
- H. S. Teoh (6/10) Jan 17 2018 You're probably looking for this syntax:
- arturg (2/12) Jan 17 2018 looks like a bug in the 3rd example.
- H. S. Teoh (6/22) Jan 17 2018 Indeed. Here's a fix:
- Azi Hassan (2/18) Jan 20 2018 That's what I was wondering about, thanks.
The D tour for structs uses a syntax similar to that of C++ in order to initialize a Person struct : Person p(30, 180). Is this syntax supported in D ? Running that part of the code neither works on the playground nor on my machine (dmd v2.076.0).
Jan 17 2018
On Wed, Jan 17, 2018 at 05:31:03PM +0000, Azi Hassan via Digitalmars-d-learn wrote:The D tour for structs uses a syntax similar to that of C++ in order to initialize a Person struct : Person p(30, 180). Is this syntax supported in D ? Running that part of the code neither works on the playground nor on my machine (dmd v2.076.0).You're probably looking for this syntax: auto p = Person(30, 180); T -- Never step over a puddle, always step around it. Chances are that whatever made it is still dripping.
Jan 17 2018
On Wednesday, 17 January 2018 at 17:37:07 UTC, H. S. Teoh wrote:On Wed, Jan 17, 2018 at 05:31:03PM +0000, Azi Hassan via Digitalmars-d-learn wrote:looks like a bug in the 3rd example.The D tour for structs uses a syntax similar to that of C++ in order to initialize a Person struct : Person p(30, 180). Is this syntax supported in D ? Running that part of the code neither works on the playground nor on my machine (dmd v2.076.0).You're probably looking for this syntax: auto p = Person(30, 180); T
Jan 17 2018
On Thu, Jan 18, 2018 at 03:50:15AM +0000, arturg via Digitalmars-d-learn wrote:On Wednesday, 17 January 2018 at 17:37:07 UTC, H. S. Teoh wrote:Indeed. Here's a fix: https://github.com/dlang-tour/english/pull/230 T -- Not all rumours are as misleading as this one.On Wed, Jan 17, 2018 at 05:31:03PM +0000, Azi Hassan via Digitalmars-d-learn wrote:looks like a bug in the 3rd example.The D tour for structs uses a syntax similar to that of C++ in order to initialize a Person struct : Person p(30, 180). Is this syntax supported in D ? Running that part of the code neither works on the playground nor on my machine (dmd v2.076.0).You're probably looking for this syntax: auto p = Person(30, 180); T
Jan 17 2018
On Thursday, 18 January 2018 at 03:50:15 UTC, arturg wrote:On Wednesday, 17 January 2018 at 17:37:07 UTC, H. S. Teoh wrote:That's what I was wondering about, thanks.On Wed, Jan 17, 2018 at 05:31:03PM +0000, Azi Hassan via Digitalmars-d-learn wrote:looks like a bug in the 3rd example.The D tour for structs uses a syntax similar to that of C++ in order to initialize a Person struct : Person p(30, 180). Is this syntax supported in D ? Running that part of the code neither works on the playground nor on my machine (dmd v2.076.0).You're probably looking for this syntax: auto p = Person(30, 180); T
Jan 20 2018