Boost logo

Boost :

Subject: [boost] Fixed point structure size
From: Soren Holstebroe (holstebroe_at_[hidden])
Date: 2009-06-25 15:46:49


Hi,

An important feature of the fixed point template is that it takes up
no more space than the underlying integer.
It should be possible to use reinterpret_cast to convert a third party
integer pointer (representing fixed ints) to a fixed point template
pointer.

The way I ensure that in my fixed point template is with a #pragma:
#pragma pack(push, 1)
... template struct ...
#pragma pack(pop)

This is supported by MSVC++ as well as gcc. However it is only defacto
standard, so it might not work on any other compiler.

Is there a more standard way to make sure that the struct is not
padded to some memory alignment size?

Soren


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