C++ Logo


Advanced search

Re: [std-proposals] uint_nopro_fast32_t : Types in <cstdint> that don't promote

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 31 Mar 2023 10:42:41 -0300
On Friday, 31 March 2023 08:47:31 -03 Frederick Virchanza Gotham via Std-
Proposals wrote:
> Sometimes I shy away from the integer types in <cstdint>, for example
> sometimes I use 'long unsigned' instead of 'uint_fast32_t', because
> the latter might promote to a signed integer.

I think this is a good idea. However, to make it a much stronger one, you may
want to focus on 8- and 16-bit types today, that do promote to int (which in
turn is usually 32 bits wide).

In writing your proposal, you may want to brush up on the specifics of what
"integer promotion" (i.e., from lesser-ranked integers to int) and "integer
conversion" mean, so you don't accidentally imply the wrong thing. You'll also
want to link to the Extended Integers content from C23 and C++23, which
created the precedent of integers that have different promotion and conversion
rules -- specifically, the Extended Floating-point paper added types smaller
than double that don't promote to double either.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-03-31 13:42:46