C++ Logo

std-discussion

Advanced search

Re: Why is size_type in std::array an alias for size_t?

From: Bo Persson <bo_at_[hidden]>
Date: Sat, 9 Nov 2019 17:14:37 +0100
On 2019-11-09 at 12:41, Wilhelm Meier via Std-Discussion wrote:
>
>
> Am 09.11.19 um 11:30 schrieb Lyberta via Std-Discussion:
>> Wilhelm Meier via Std-Discussion:
>>>> Of course, bigger problem is that CHAR_BIT can be more than 8.
>>>
>>> I dont't see the point here. Can you elaborate on that?
>>
>> That means that generally reasoning about sizes of types is difficult.
>>
>> What if CHAR_BIT is 10?
>>
>> Then both Size < 256 and Size < 65536 don't make sense as now all the
>> numbers derived from number of bits in a byte are different.
>
> Yes of course. But my proposal was to use uint8_t oder uin16_t, so the
> CHAR_BIT doen't matter here.
>

But if CHAR_BIT is 10, you probably don't have any char8_t or char16_t
types. So in a way it *does* matter.

Received on 2019-11-09 10:17:04