On Wed, 1 Mar 2023 at 18:54, Jonathan Wakely via Std-Proposals <std-proposals@lists.isocpp.org> wrote:


On Wed, 1 Mar 2023, 20:48 Ray Gardener via Std-Proposals, <std-proposals@lists.isocpp.org> 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@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals