Boost logo

Boost :

Subject: Re: [boost] [lockfree] _ENABLE_ATOMIC_ALIGNMENT_FIX for VS 2015Update 2
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2016-05-10 10:29:18


On Tuesday, 10 May 2016 17:28:43 MSK Peter Dimov wrote:
> Tim Blechmann wrote:
> > > class tagged_index
> > > {
> > >
> > > public:
> > > typedef boost::uint16_t tag_t;
> > > typedef boost::uint16_t index_t;
> > >
> > > protected:
> > > index_t index;
> > > tag_t tag;
> > >
> > > };
> > >
> > >
> > > This is by design - your tagged_index has align 2, size 4, triggering
> > > the need for my atomic alignment fix.
> >
> > boost lockfree ensure alignment of the atomics, so this warning is a false
> > positive. sending a warning is good and nice, but a compile error is
> > overkill imho. this code dates back before c++11 and still supports c++03
> > compilers.
>
> You can in principle fix that by adding __declspec(align(4)) to tagged_index
> on MSVC.

...or a more portable BOOST_ALIGNMENT(4).


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