Boost logo

Boost :

Subject: Re: [boost] [lockfree] _ENABLE_ATOMIC_ALIGNMENT_FIX for VS 2015Update 2
From: Peter Dimov (lists_at_[hidden])
Date: 2016-05-10 09:57:58


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.


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