Date: Tue, 2 Sep 2025 09:33:36 +0200
On 01/09/2025 20:02, Jan Schultke via Std-Proposals wrote:
> Hey,
>
> As some of you may already know, I am working on bringing bit-precise
> integers (_BitInt) to C++. See a very early draft of the paper here:
>
> https://isocpp.org/files/papers/D3666r0.html
>
> The debate over whether _BitInt should be a fundamental type or
> library type has been largely settled, however there are two other
> contentious points:
>
> 1. C does not allow _BitInt(1); should C++ to make generic programming
> more comfortable?
That would allow values -1 and 0, which seems reasonable to me.
> 2. Should the _BitInt keyword exist in C++? I currently propose to
> have it, mainly because it inevitably will exist as a compiler
> extension or compatibility macro, and it seems pointlessly
> user-hostile not to just standardize existing practice.
>
I think the key criteria for _BitInt in C++ should be that _BitInt code
that is syntactically valid in C and C++ should have identical
semantics. Anything else would be chaos.
C++ programmers might feel more comfortable with std::bitint<N> than
_BitInt(N), so IMHO both must exist. Which of these is fundamental, and
which is defined in terms of the other, should make no difference to the
user. The word "_BitInt" should not be in conflict with any user
identifier, so it seems fine to me that it is a keyword - that would
also make syntax highlighting editors consistent between C++29 (if
that's when this arrives) and C23.
> If you have some early feedback, especially feedback on these two
> points, that would be appreciated.
>
> You should expect the finished paper to be in the September mailing.
>
>
> Jan
> Hey,
>
> As some of you may already know, I am working on bringing bit-precise
> integers (_BitInt) to C++. See a very early draft of the paper here:
>
> https://isocpp.org/files/papers/D3666r0.html
>
> The debate over whether _BitInt should be a fundamental type or
> library type has been largely settled, however there are two other
> contentious points:
>
> 1. C does not allow _BitInt(1); should C++ to make generic programming
> more comfortable?
That would allow values -1 and 0, which seems reasonable to me.
> 2. Should the _BitInt keyword exist in C++? I currently propose to
> have it, mainly because it inevitably will exist as a compiler
> extension or compatibility macro, and it seems pointlessly
> user-hostile not to just standardize existing practice.
>
I think the key criteria for _BitInt in C++ should be that _BitInt code
that is syntactically valid in C and C++ should have identical
semantics. Anything else would be chaos.
C++ programmers might feel more comfortable with std::bitint<N> than
_BitInt(N), so IMHO both must exist. Which of these is fundamental, and
which is defined in terms of the other, should make no difference to the
user. The word "_BitInt" should not be in conflict with any user
identifier, so it seems fine to me that it is a keyword - that would
also make syntax highlighting editors consistent between C++29 (if
that's when this arrives) and C23.
> If you have some early feedback, especially feedback on these two
> points, that would be appreciated.
>
> You should expect the finished paper to be in the September mailing.
>
>
> Jan
Received on 2025-09-02 07:33:41