Union redux
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 1 14:22:47 PDT 2015
On 6/1/15 5:02 PM, Walter Bright wrote:
> On 6/1/2015 12:43 PM, Andrei Alexandrescu wrote:
>> On 6/1/15 12:00 PM, deadalnix wrote:
>>> 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.
>>
>> Fine.
>
> "Fine" as in "yes" :-)
>
> For non-native speakers, the use of "fine" is often confusing. "Fine" in
> American english means "you're wrong, but I won't argue the point." It
> does not signify endorsement.
Yes and no :) It all depends on the context and emotion. There is so
little emotion in posts, and having one-word sentences doesn't help.
Reading "Fine." in context of all of Andrei's other answers, I took it
to mean "yeah, that's fine" -- i.e. "I agree"
>>> 5/ union currently disallow members with postblit and/or destructor . It
>>> seems that this was needed in C++ as per Andrei's comments. It seems to
>>> me that, because of manual memory management, C++ would have a lot more
>>> struct with copy constructor and/or destructor than in D, so I'm not
>>> sure if this require change in spec. Andrei, can you give more details
>>> on the C++ situation here ?
>>
>> That rule has hurt C++ everywhere, and the community credits Lois
>> Goldthwaite
>> for pushing the current rule, which allows types with cdtors in
>> unions. Let's go
>> the same way, unions are all but useless otherwise.
>
> I defer to Andrei's expertise here.
I would make it clear here what you mean. I can't tell what "the rule"
is (there may be 2 rules, or 1, but I can't tell), and whether Andrei
agrees we should do it or not.
-Steve
More information about the Digitalmars-d
mailing list