Boost logo

Boost :

Subject: [boost] [interprocess] 32-bit offset_ptr
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2019-02-02 16:28:57


Dear Experts,

I have some old code that uses 32-bit offset_ptrs, i.e.

   typedef boost::interprocess::offset_ptr<void, int32_t, int32_t> ptr_t;

This has stopped working on 64-bit systems at some point since 1.58.
git blame
suggests a commit on 14 Oct 2015. There is now a static assert that
checks that
OffsetType is at least as large as a raw pointer.

In the current case, I'm using these pointers within memory-mapped
files which will
always be vastly smaller than the 32-bit limit. Using 32-bit offsets seemed
like a worthwhile optimisation at the time, and now I am hoping to maintain
binary compatibility with those files.

In the past I've also used them to save memory on 64-bit systems with pointer-heavy
data structures (using boost.intrusive) using an allocator that
operates within a
small memory region.

Has something changed within the implementation that makes this restriction
necessary? Was it never supposed to work as I was using it?

There is also an assert that OffsetType is unsigned, which wasn't there before.
Maybe I was doing that wrong.

Thanks for any advice.

Regards, Phil.


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