C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D3666R0 Bit-precise integers

From: Hans Åberg <haberg_1_at_[hidden]>
Date: Tue, 2 Sep 2025 13:32:25 +0200
> On 1 Sep 2025, at 20:02, Jan Schultke via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> 1. C does not allow _BitInt(1); should C++ to make generic programming
> more comfortable?

The ring ℤ/2ℤ of integers modulo 2, also a field, is isomorphic to the Boolean ring 𝔹 having exclusive or as addition and logical conjunction as multiplication.

If bool 1+1 is defined to 0, then it is already in C++.

However, in GCC and Clang, bool 1+1 = 1, and I could not see what the standard specifies.

Received on 2025-09-02 11:32:41