C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Array Index in Range-based For Loops

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 01 Mar 2023 22:35:05 -0800
On Wednesday, 1 March 2023 17:04:39 PST Edward Catmur via Std-Proposals wrote:
> I'm not entirely sure that size_t can't promote to
> int, although obviously it doesn't on any sensible platform.

It's possible. Integer promotion rules say that only types of rank lesser than
int can promote to int and only so long as all the values of that integer fit
int, otherwise they promote to unsigned. Therefore, you'd need to find a
platform where

  sizeof(size_t) < sizeof(int)

That is permitted, but I don't think exists or has ever existed.

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

Received on 2023-03-02 06:35:08