Paulo Pinto:
Same thing about unions, as you wouldn't know which
pointer/reference is the active one without some kind of
tagging.
But with a standard method like activeField the tagging doesn't
need to be explicit.
Bye,
bearophile
On Wed, 15 Aug 2012 07:09:40 +0200, Jonathan M Davis
wrote:
On Wednesday, August 15, 2012 07:02:25 Simen Kjaeraas wrote:
On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu
wrote:
> On 8/14/12 3:25 PM, bearophile wrote:
>> D2 doesn't give you that restriction, and when an union goes ou
On Wednesday, 15 August 2012 at 05:10:02 UTC, Jonathan M Davis
wrote:
On Wednesday, August 15, 2012 07:02:25 Simen Kjaeraas wrote:
On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu
wrote:
> On 8/14/12 3:25 PM, bearophile wrote:
>> D2 doesn't give you that restriction, and when an union
On Wednesday, August 15, 2012 07:02:25 Simen Kjaeraas wrote:
> On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu
>
> wrote:
> > On 8/14/12 3:25 PM, bearophile wrote:
> >> D2 doesn't give you that restriction, and when an union goes out of
> >
> >> scope it calls the destructors of all its
On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu
wrote:
On 8/14/12 3:25 PM, bearophile wrote:
D2 doesn't give you that restriction, and when an union goes out of
scope it calls the destructors of all its fields:
That's pretty surprising. "Major bug" doesn't begin to describe it.
Un
Andrei Alexandrescu:
That's pretty surprising. "Major bug" doesn't begin to describe
it.
If you want later I will add it to Bugzilla. But maybe before
that other people will want to write some other comments in this
thread.
Unions should call no constructors and no destructors.
But thi
On 8/14/12 3:25 PM, bearophile wrote:
D2 doesn't give you that restriction, and when an union goes out of
scope it calls the destructors of all its fields:
That's pretty surprising. "Major bug" doesn't begin to describe it.
Unions should call no constructors and no destructors.
Andrei
Before C++11 you weren't allowed to write something like:
union U {
int x;
std::vector v;
} myu;
because v has an elaborate destructor.
In C++11 they have added "Unrestricted unions", already present
in g++ since version 4.6:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2