C++ Logo

std-proposals

Advanced search

Re: [std-proposals] CHAR_BIT == 8 p3635r0

From: Tom Honermann <tom_at_[hidden]>
Date: Wed, 16 Jul 2025 17:36:33 -0400
On 7/16/25 8:03 AM, Jan Schultke via Std-Proposals wrote:
>> What does non-8-bit mean? The standard demands >= 8 bits per char.
> Platforms which do not allow you to address octets of memory.
>
> ALUs and arithmetic having exotic "natural sizes" like 24 bits are not
> a problem and can be different from the byte size. As you've said,
> that can be covered by intrinsics and whatnot.
>
> The smallest addressable size is more limiting because you have to be
> able to modify bytes without data races/any impact on adjacent bytes,
> and that's impossible or costly to emulate. If you can only modify 16
> bits at a time, how do you write one octet of memory without a data
> race, strictly guaranteed?

You would store each octet in one 16-bit byte. It is the same situation
as storing a sequence of 4-bit nibbles in 8-bit bytes. You don't have to
use all the bits available.

Tom.

>
>> It does not make sense to support the latest C++, but then use an exotic byte size.
> Agreed.

Received on 2025-07-16 21:36:41