Boost logo

Boost :

From: Stephen Cleary (scleary_at_[hidden])
Date: 2000-03-03 12:02:01


"reid sweatman" wrote:
> Hope this isn't off-target, but have you considered instances where
the
> programmer might want to specify data alignments that don't
correspond to
> any native data type? For instance, some architectures make it
possible to
> trade off packing space for access speed, often as a result of a cache
> issue. I'm not proposing any attempt to do the sort of thing we do
when
> writing highly-optimzed cache-handling code, which is usually in
assembler,
> anyway, but it would be nice to have the option of specifying an
alignment
> value as an argument, and if no argument is specified, it would
default to
> the scheme you specify.

The scheme we have will work for the alignment requirements of any
native or user-defined type. It would be possible (almost trivial) to
add programmer specifying of alignment requirements, but I have to
question if this is necessary.

Even when dealing with embedded systems, there's usually some form of
#pragma "packed" or keyword "__packed__" that will inform the compiler
to pack and align the structures in a more memory-efficient way. If
the compiler is aware of it, our code will automatically conform; so I
would recommend just informing the compiler, making the overrides in
our class unnecessary.

       -Steve


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