Re: [hackers] [libgrapheme] Use SIZE_MAX instead of (size_t)-1 || Laslo Hunhold

From: Laslo Hunhold <>
Date: Sat, 18 Dec 2021 22:16:38 +0100

On Sat, 18 Dec 2021 15:07:30 -0500
Ethan Sommer <> wrote:

Dear Ethan,

> > (size_t)-1 is also undefined behaviour.
> It isn't, wrap-around with unsigned types is defined, it's only signed
> overflow that isn't.

yes, exactly. For posterity, the standard specifies that in

  "Otherwise, if the new type is unsigned, the value is converted by
  repeatedly adding or subtracting one more than the maximum value that
  can be represented in the new type until the value is in the range of
  the new type."

With best regards

Received on Sat Dec 18 2021 - 22:16:38 CET

This archive was generated by hypermail 2.3.0 : Sat Dec 18 2021 - 22:24:30 CET