C++ Logo


Advanced search

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

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 1 Mar 2023 11:38:34 -0500
On Wed, Mar 1, 2023 at 11:32 AM Ray Gardener via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> size_t can be assigned -1?

Since C++20, signed integers are two's complement, and the conversion
from signed to unsigned for negative numbers is done in a two's
complement way. So yes, this is now well-defined.

Received on 2023-03-01 16:39:25