
Ivan Matek wrote:
On Wed, Dec 4, 2024 at 2:36 PM Claudio DeSouza via Boost < boost@lists.boost.org> wrote:
There has been some discussion about this and the consensus is that `uint8_t` is a better option than `std::byte` as the former represents a determinate number of bytes ( https://isocpp.org/wiki/faq/intrinsic-types#bits-per-byte). So `span<const uint8_t>, and `span
` for immutable and mutable bytes respectively. I presume think static_assert for CHAR_BIT value is enough, I am not aware of anybody using systems where this is not true, despite what faq says... but I must admit I am not familiar with all weird archs so I could be wrong
Using uint8_t is equivalent to asserting that CHAR_BIT is 8. In practice, uint8_t, when defined, is always unsigned char, except when it's `char` on platforms that strive to make your life interesting. But that's non-conforming. There's an attempt to make CHAR_BIT == 8 required http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3477r0.html but it might be slightly ahead of its time because a few holdover platforms with CHAR_BIT == 32 still remain in use. (On these, uint8_t is a compile time error.)