Boost logo

Boost :

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


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

On Wednesday 22 September 2010, Larry Evans wrote:
> On 09/22/10 13:00, Frank Mori Hess wrote:
> > On Wednesday 22 September 2010, Larry Evans wrote:
> >> Strict aliasing is an assumption, made by the C (or C++) compiler,
> >> that dereferencing pointers to objects of different types will
> >> never refer to the same memory location (i.e. alias each other.)
> >>
> >> Could you point to the variant code violating this rule?
> >
> > 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.
>
> So now my other question: how can C++0x avoid this?

I think it would be because C++0x allows non-pod types in unions.

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

iEYEARECAAYFAkyaTRgACgkQ5vihyNWuA4WAbQCeJ8LhMsaj4OkEJT2Jm4tM96to
XgMAoJ8TkOfY4gct23j6UrXeYIchtahr
=O9Qv
-----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