Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian mini-review
From: Olaf van der Spek (ml_at_[hidden])
Date: 2015-01-24 10:52:53


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."

-- 
Olaf

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