C++ Logo

std-proposals

Advanced search

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

From: Yexuan Xiao <bizwen_at_[hidden]>
Date: Thu, 4 Sep 2025 12:31:28 +0000
A few years ago when I learned that _Bitint was included in C23, I also thought about this issue many times. My conclusion is that implementing it using a class template is really not a good idea, and using a built-in type would make things easier for its users. However, I believe that using a library to address the surprising results of integer promotions in bitwise operations is better than using _Bitint. Additionally, I’m not a fan of the underscore in the name bit_int.


________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Jan Schultke via Std-Proposals <std-proposals_at_[hidden]>
Sent: Tuesday, September 2, 2025 2:02
To: C++ Proposals <std-proposals_at_[hidden]>
Cc: Jan Schultke <janschultke_at_[hidden]>
Subject: [std-proposals] D3666R0 Bit-precise integers

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://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fisocpp.org%2Ffiles%2Fpapers%2FD3666r0.html&data=05%7C02%7C%7C2ba384a14ce840cd947408dde981ccc5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638923465901434139%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=%2F4Joa0SNDCHPBs%2BMouIx9TklDd3yo59gkfwKQPznU3k%3D&reserved=0<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?
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.

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
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.isocpp.org%2Fmailman%2Flistinfo.cgi%2Fstd-proposals&data=05%7C02%7C%7C2ba384a14ce840cd947408dde981ccc5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638923465901454554%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=SPqpYPQPI9SBodwx8V1Mc9nRRfo8g6XmnPaZRla9Jgc%3D&reserved=0<https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>

Received on 2025-09-04 12:31:48