Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian mini-review
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-24 11:04:15


Olaf van der Spek wrote:
> On Sat, Jan 24, 2015 at 3:54 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
> > struct
> > {
> > big_int32_buf_t code;
> > big_uint32_buf_t length;
> > little_int16_buf_t version;
> > big_int32_buf_ut shape_type;
> > } data;
>
> You're mixing aligned and unaligned types. Shouldn't all be unaligned? See
> the docs: "Warning: Code that uses aligned types is possibly non-portable
> because alignment requirements vary between hardware architectures and
> because alignment may be affected by compiler switches or pragmas. For
> example, alignment of an 64-bit integer may be to a 32-bit boundary on a
> 32-bit machine. Furthermore, aligned types are only available on
> architectures with 16, 32, and 64-bit integer types."

Yes, a good argument against having aligned buffers at all, even though the
docs do provide rationale for them. If you want aligned, use the non-buffer
types.


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