Am Sat, Jun 15, 2024 at 06:10:50PM +0200 schrieb Vincent Lefevre: > IMHO, this has been poorly designed. There should have been a macro > taking a parameter N (an integer constant expression), where the > type would have been valid for any N up to the maximum width (thus > at least 64). For portability, the existence of the macro could have > also been tested with #ifdef, allowing a fallback.
Well, there is INT_LEAST${N}_MAX from stdint.h, telling you that type int_least${n}_t exists. And C23 has the new _BitInt(N) types, if that helps any. Of course, you can also just face up to reality and notice that you will likely never work on a machine with CHAR_BIT != 8, and even if you do, it will be unlikely to have CHAR_BIT % 8 != 0. Therefore, any int_least${n}_t with $n % 8 != 0 is unlikely to exist. Ciao, Markus