Boost logo

Boost :

Subject: Re: [boost] aligned_storage in unions
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2010-09-22 15:04:41


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 22 September 2010, Larry Evans wrote:
> On 09/22/10 13:14, Larry Evans wrote:
> > On 09/22/10 13:00, Frank Mori Hess wrote:
>
> [snip]
>
> >> How about if you re-assign a variant to a different type. Won't it
> >> re-use the same in-place storage for a different type?
> >
> > Yes, AFAICT. Thanks.
>
> Rethought that answer because I don't (yet)
> see where pointers to the 2 different types
> exist at the same time in the operator= for

I don't see how that gets around the anti-aliasing rules. The compiler is
allowed to assume incompatible pointers won't _ever_ alias. So just because
your program does things in a certain order doesn't mean the compiler isn't
allowed to use the anti-aliasing assumptions to reorder things in a nasty
way. Couldn't it look at the destruction of the old object and the
construction of the new object as two completely independent actions it is
free to reorder or interleave?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkyaU0kACgkQ5vihyNWuA4VwNwCeLT5m2y27SxSucxI0Oa3nub/a
7zkAoMlKG5uvCJn3vAIAHRX1Xhg9wk7R
=KExQ
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk