Boost logo

Boost :

From: Michael Marcin (mike_at_[hidden])
Date: 2006-09-22 13:50:08


Olivier Grant wrote:
> Well due to the fact that floats are represented on 4 bytes, there shouldn't
> be any padding involved. Padding normally occures when certain member
> variables of a structure require certain alignment constraints or just for
> efficiency, but this shouldn't occur with a vector class (at least that is
> my understanding).
>
> It is the same thing with alignment. the beginning of the structure is
> placed on a certain boundary but doesn't affect the padding of elements
> within the structure. You could set this vector class to be 16 bytes aligned
> if you wanted to use them with SSE instructions, and you can still access
> the member with the array operator without problems.
>

On a 64-bit system the compiler might align to 8-byte boundaries.

Also if you want a generic vector class you can't assume anything like that.

Also for indexing with x,y,z/[0,1,2] all union tricks are out if you
want to support UDTs.

P.S. there is a mailing list that might be of interest to some in this
discussion.

http://sourceforge.net/mailarchive/forum.php?forum_id=49012


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