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:37:36 -0800
On Wednesday, 1 March 2023 08:51:39 PST Federico Kircheis via Std-Proposals
wrote:
> Why not?
>
> size_t has a value, that added to 1, gives 0 as result

Indeed

    size_t x = -1;

declares the same as

    size_t x = 0 - 1;

but is not the same as

    size_t x = 0u - 1;
(on 64-bit platforms)

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

Received on 2023-03-02 06:37:37