C++ Logo

std-proposals

Advanced search

Re: Restrict possible values of CHAR_BIT

From: Matthew Woehlke <mwoehlke.floss_at_[hidden]>
Date: Tue, 29 Oct 2019 11:01:26 -0400
On 28/10/2019 12.10, Thiago Macieira wrote:
> On Monday, 28 October 2019 08:47:26 PDT Arthur O'Dwyer wrote:
>> I also wonder what such a machine would do with `char8_t`, or character
>> processing in general. (I mean, it could just waste half of the space in
>> each 16-bit word; but it seems like it would be easier to just store two
>> C++ "bytes" in each 16-bit word.)
>
> You can do that, if you also shift the pointer addresses left and add an extra
> bit to indicate whether you meant the lower or upper half of each word. And
> correspondingly allowed dereferencing of each unit, individually.
>
> Obviously, atomic_uint8_t, atomic_char, atomic_uchar, atomic_char8_t would not
> exist.

Can't these be implemented by simply operating on a larger type and
ignoring the extra bits?

They wouldn't be able to work on e.g. a uint8_t at arbitrary alignment,
but I didn't think the atomic classes allowed that anyway?

Aren't there already architectures on which you can't perform an atomic
operation on an arbitrary byte? I'm not sure even x64 allows that...

-- 
Matthew

Received on 2019-10-29 10:03:44