C++ Logo

std-proposals

Advanced search

Re: Restrict possible values of CHAR_BIT

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Thu, 24 Oct 2019 16:52:37 -0400
On Thu, Oct 24, 2019 at 4:10 PM Tjernstrom, Staffan via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Looking at interactions with (and by extension, programming on) FPGAs,
> where everything is bit-based, it's common to find things like 14-bit
> values. We have 14-bit types in our internal type system.
>

Yes, but "a 14-bit type exists" is not the same thing as "CHAR_BIT==14". I
would be as surprised as Lyberta (and perhaps more so) if any C++ compiler
in the world supported "CHAR_BIT==14".

However, I agree with Tom that this proposal is not motivated. Personally I
think it'd be just as silly to have CHAR_BIT==16 or CHAR_BIT==32 as to have
CHAR_BIT==9 or CHAR_BIT==24. If we're trying to get C++ to fall in line
with what "everybody knows," then the way to do that is to mandate
CHAR_BIT==8, not to keep the current situation of "CHAR_BIT==I don't know,
ask your vendor" but also put odd restrictions on the vendor's choice.

Lyberta, did your survey turn up any C++ implementations where CHAR_BIT !=
8? If so, what version of C++ were they — C++03, 11, 14, 17?

my $.02,
–Arthur

Received on 2019-10-24 15:55:05