C++ Logo


Advanced search

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

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Wed, 1 Mar 2023 19:04:39 -0600
On Wed, 1 Mar 2023 at 18:54, Jonathan Wakely via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Wed, 1 Mar 2023, 20:48 Ray Gardener via Std-Proposals, <
> std-proposals_at_[hidden]> wrote:
>> Not gonna lie, if I see code exploiting integer overflow, I reject it. It
>> just smells hoity-toity. I like code to be dead obvious.
>> And as for assigning negative numbers to unsigned types, whatever
>> happened to type safety?
> Would you prefer -1zu then? That's a literal of type size_t so there's no
> negative number and no question of it being not "type safe". It means
> exactly the same thing though.

Strictly speaking, it's a unary expression where the cast-expression is a
literal of type size_t. I'm not entirely sure that size_t can't promote to
int, although obviously it doesn't on any sensible platform.

> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-03-02 01:04:52