Boost logo

Boost :

Subject: Re: [boost] [forward_declare] Interest Inquiry toward Faster Compile Times
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2012-08-02 00:44:40


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).

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?

  

> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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