
On Aug 2, 2012, at 12:34 AM, Andrey Semashev <andrey.semashev@gmail.com> 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