Union redux

Manu via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 2 01:48:44 PDT 2015


On 2 June 2015 at 05:00, deadalnix via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> After discussion at DConf, it ends up that union have some lack of
> specification, and some nonsensical behavior right now. Here are some points
> discussed and possible solutions :
>
> 1/ .init for unions is not defined. I propose to define it as the .init of
> the first field + padding with 0s if the union is larger than its first
> member. It seems to be what is generated right now.

Isn't it the case that some of the members of a union need to be
declared with init =void, such that only one version of the union
provides the init values?
At that point, isn't the state of init clearly defined by the members
that aren't =void?


More information about the Digitalmars-d mailing list