C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Shorter fixed-width integer types

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 02 Jul 2025 06:45:15 -0700
On Wednesday, 2 July 2025 06:14:29 Pacific Daylight Time Sebastian Wittmeier
via Std-Proposals wrote:
> If something has at least (>=) 8 bits, then it can also have e.g. 16 bits?
>
> Even if bytes are 8 bits?

https://cigix.me/c17#7.20.1.2.p2:

"The typedef name uint_leastN_t designates an unsigned integer type with a
width of at least N, such that no unsigned integer type with lesser size has
at least the specified width. "

So no, if bytes are 8 bits, that means there's an integer type with 8 bits,
meaning uint_least8_t must be that type, not bigger.

But on the discussed DSP with 16-bit chars, uint_least8_t would be 16 bits
wide. In fact, uint_least8_t is always the same size as unsigned char and
usually the same type.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Platform & System Engineering

Received on 2025-07-02 13:45:17