Boost logo

Boost :

Subject: Re: [boost] [endian] Request for comments
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2019-04-28 10:21:00

Hi Peter,

On Sat, Apr 27, 2019 at 7:18 PM Peter Dimov via Boost <boost_at_[hidden]>

> 1. endian_arithmetic<...> derives publicly from endian_buffer<...>.
> Intuitively, this inheritance relationship doesn't seem right, and it
> prevents endian_arithmetic from being a C++03 POD, due to having a base
> class.

I assume that the potential user base of Boost.Endian would benefit from
endian_arithmetic begin a C++03 POD. I also assume that not many people
explicitly rely on casts to the public base class... yet. Better to break
now than later. I vote for the change,

2. the data() member function returns char const*. This type is strongly
> associated with null-terminated strings, and as such, using it for the
> underlying bytes of the endian object seems error-prone. I'd much prefer
> to
> return `unsigned char const*` from data() (although in C++17 `std::byte
> const*` might be even better.)
> I can't however estimate with any certainty whether the (mostly aesthetic)
> benefit of these changes would outweigh the users' annoyance from their
> code
> being broken for no strong reason.

You could offer a smooth transition with a proxy that has a deprecated
`operator char const*` and a non deprecated `operator unsigned char

By the way, is there a hack to emulate a compile-time deprecation warning
on pre C++14 compilers?

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