Boost logo

Boost :

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

On Sun, Jan 25, 2015 at 5:53 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
> I thought that at one time, too, and the names were as you suggest.
> There were several problems with defaulting to unaligned and thus
> having longer names for aligned types.
> 1) Real-world applications use aligned data layouts far more often
> than unaligned. Users prefer that defaults meet the most common needs.

Unaligned types support all cases, aligned types do not, so it's at
most a performance issue.

> 2) If the default is unaligned, unaligned types will get used
> inadvertently where aligned types could be used, and that can cause
> performance problems. Remember that the familiar <cstdint> types (e.g.
> int16_t, int32_t) are aligned types. It is natural to assume
> big_int32_t is an aligned type.


BTW, what about the requested read_be32 and write_be32 etc variants?
Having a way to read an int somewhere out of a (unsigned) char buffer
is really handy.


Boost list run by bdawes at, gregod at, cpdaniel at, john at