Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-06-03 18:24:23


On 6/3/06, Thorsten Ottosen <thorsten.ottosen_at_[hidden]> wrote:
> This is more a couple of questions that comments.
>
> 1. have I misunderstood aligmnet completely when I thought that a single
> data member was not guaranteed to be aligned, but an array ways?

An array of some type gets the same alignment as a scalar of that type.

> (your aligned types use a data member, your unaligned use a char array).
>
> 2. why is a char array used, and not, say, a T[1] array?

T[1] is given the same alignment by the compiler as T. Also, T is the
wrong size except for the case where sizeof(T) == num_bytes.

--Beman


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