Re: Initialization of struct containing anonymous union

2017-08-14 Thread Carl Sturtivant via Digitalmars-d-learn
On Monday, 14 August 2017 at 15:11:35 UTC, Steven Schveighoffer wrote: On 8/14/17 10:57 AM, Carl Sturtivant wrote: On Monday, 14 August 2017 at 14:49:57 UTC, Steven Schveighoffer wrote: On 8/14/17 10:36 AM, Carl Sturtivant wrote: On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer

Re: Initialization of struct containing anonymous union

2017-08-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/14/17 10:57 AM, Carl Sturtivant wrote: On Monday, 14 August 2017 at 14:49:57 UTC, Steven Schveighoffer wrote: On 8/14/17 10:36 AM, Carl Sturtivant wrote: On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer wrote: I think what the docs mean is that as soon as an anonymous unio

Re: Initialization of struct containing anonymous union

2017-08-14 Thread Carl Sturtivant via Digitalmars-d-learn
On Monday, 14 August 2017 at 14:49:57 UTC, Steven Schveighoffer wrote: On 8/14/17 10:36 AM, Carl Sturtivant wrote: On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer wrote: I think what the docs mean is that as soon as an anonymous union is present, you can't initialize anything

Re: Initialization of struct containing anonymous union

2017-08-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/14/17 10:36 AM, Carl Sturtivant wrote: On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer wrote: I think what the docs mean is that as soon as an anonymous union is present, you can't initialize anything further than the first union field. I understood that, hence my remar

Re: Initialization of struct containing anonymous union

2017-08-14 Thread Carl Sturtivant via Digitalmars-d-learn
On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer wrote: I think what the docs mean is that as soon as an anonymous union is present, you can't initialize anything further than the first union field. I understood that, hence my remark that "this is not helpful". So it seems I

Re: Initialization of struct containing anonymous union

2017-08-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/14/17 9:49 AM, Carl Sturtivant wrote: struct mess { union { int i; string s; } double x; } How do I cleanly initialize this, assuming it's i that I want to give an overt value to? The docs say "If there are anonymous unions in the struct, on

Initialization of struct containing anonymous union

2017-08-14 Thread Carl Sturtivant via Digitalmars-d-learn
struct mess { union { int i; string s; } double x; } How do I cleanly initialize this, assuming it's i that I want to give an overt value to? The docs say "If there are anonymous unions in the struct, only the first member of the anonymous union can be in