Subject: Re: [boost] [forward_declare] Interest Inquiry toward Faster Compile Times
From: Lars Viklund (zao_at_[hidden])
Date: 2012-08-02 00:52:56
On Thu, Aug 02, 2012 at 12:44:40AM -0400, Daniel Larimer wrote:
> On Aug 2, 2012, at 12:34 AM, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
> > On Thursday 02 August 2012 06:03:22 Lars Viklund wrote:
> >> 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
> >> guess.
> > Yes, this is a requirement for pointers returned by malloc and ::operator new.
> > Structure's alignment is the largest alignment of its members. Array's
> > alignment is the alignment of the array element.
> this requirement does not hold for stack allocated objects. Looks like I would have to modify it to use the aligned storage, although the code appears to work with mis-aligned double (pointing at an 'odd' address).
Try "any type wider than an octet on pretty much any platform not x86".
You're paying a massive cost on x86 for misaligned accesses too.
Floating point numbers and SSE extensions will blow up even harder on
> I am sure that some types will require proper alignment. Options include always allocating arrays in chunks of 8 bytes by switching to an int64 array and eating the 'overhead'. Anything require alignment greater than 8 bytes?
-- Lars Viklund | zao_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk