Boost logo

Boost :

Subject: Re: [boost] [forward_declare] Interest Inquiry toward Faster Compile Times
From: Lars Viklund (zao_at_[hidden])
Date: 2012-08-02 00:03:22

On Wed, Aug 01, 2012 at 10:37:24PM -0500, Larry Evans wrote:
> On 08/01/12 20:18, Daniel Larimer wrote:
> > Julien,
> > An extra 'byte' was just left over from me testing. It works with 8
> > bytes (2 ints) and it asserts on 7 bytes. I was trying to find a
> > way to 'warn' if you reserved too much. It looks like
> > BOOST_STATIC_WARN() has been removed.
> >
> > I thought about alignment issues (I am no expert here), but my
> > understanding is that structs/classes are always 'aligned' in the
> > same manner regardless of what is stored. Therefore, if my fwd<>
> > class only has one data member (an array) it should be aligned
> > appropriately for any type.
> >
> I'm pretty sure that you're array, char fwd<T,S>::_store[S], has an
> alignment of 1; thus, If T is double, it would not be aligned properly.
> You need to use an aligned buffer, which boost provides and is also in
> the standard someplace. boost::variant uses the boost aligned buffer
> for its storage buffer.

Isn't there a standard section that mentions that some flavor of
sequence-of-char storage must have alignment suitable for any natural
alignment on the platform?

Might just be constrained to free store allocations or something, I

Lars Viklund | zao_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at