Date: Wed, 31 Jan 2024 13:47:27 -0800
On Wednesday, 31 January 2024 06:50:20 PST Arthur O'Dwyer via Std-Proposals
wrote:
> I don't necessarily object to providing a std::bit_int<N> alias in some
> standard header; but I would very much like to be able
> - to use `_BitInt` in C++ programs *in the core language*, without
> including any standard headers;
Why? You can't use std::uint64_t without <cstdint>, std::float16_t without
<stdfloat> and even std::nullptr_t without <cstddef>.
Even more closely, you need <atomic> for std::atomic<T>, as _Atomic(T) is not
part of the C++ language (though your compiler probably allows it).
> - to use the same syntax for `_BitInt(N)` in both C and C++ (e.g. in header
> files shared between languages, without adding extra #ifdefs)
In this case, that's a valid request, but then just use the C syntax and
assume your C-and-C++ compiler does support that in C++ mode. Headers that
work in C are not part of the C++ language.
Is stdio.h part of the C++ standard?
> - to be able to express `unsigned _BitInt(N)` by putting the token
> `unsigned` next to the name of the type, instead of by wrapping it in
> `std::make_unsigned_t` (which again requires including a standard header)
But the converse doesn't apply: you can't make_signed by adding a "signed" to
where an "unsigned" is already present.
> For better and worse: Present-day C++ supports *exactly one* _Camel
> keyword: `_Pragma`.
wrote:
> I don't necessarily object to providing a std::bit_int<N> alias in some
> standard header; but I would very much like to be able
> - to use `_BitInt` in C++ programs *in the core language*, without
> including any standard headers;
Why? You can't use std::uint64_t without <cstdint>, std::float16_t without
<stdfloat> and even std::nullptr_t without <cstddef>.
Even more closely, you need <atomic> for std::atomic<T>, as _Atomic(T) is not
part of the C++ language (though your compiler probably allows it).
> - to use the same syntax for `_BitInt(N)` in both C and C++ (e.g. in header
> files shared between languages, without adding extra #ifdefs)
In this case, that's a valid request, but then just use the C syntax and
assume your C-and-C++ compiler does support that in C++ mode. Headers that
work in C are not part of the C++ language.
Is stdio.h part of the C++ standard?
> - to be able to express `unsigned _BitInt(N)` by putting the token
> `unsigned` next to the name of the type, instead of by wrapping it in
> `std::make_unsigned_t` (which again requires including a standard header)
But the converse doesn't apply: you can't make_signed by adding a "signed" to
where an "unsigned" is already present.
> For better and worse: Present-day C++ supports *exactly one* _Camel
> keyword: `_Pragma`.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DCAI Cloud Engineering
Received on 2024-01-31 21:47:29