Subject: Re: [boost] interest in a stateful pointer library?
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2017-10-09 11:42:03
On Mon, Oct 9, 2017 at 5:32 AM, Hans Dembinski wrote:
> Please have a look at the updated README on Github. tagged_ptr uses
> Boost.Align to get pointers with a special bit pattern which allows to
> perfectly predict these bits and therefore use them to hold state. I thought
> that this trick was platform-independent, since Boost.Align seems platform-
> independent, but smart people on Reddit showed me that I am relying on
> undefined behaviour here. It turns out that the conversion between
> memory address and integers may not be as trivial as it is on a x86
> machine, and then this trick would fail.
If you're referring to the implementation of boost::alignment::align,
it is platform-dependent. i.e. That is one of the reasons we wanted it
in a Boost library: So that if there is a C++ implementation which
requires a different platform-dependent solution, then
boost::alignment::align will be updated to support that too.