Re:My first verified imperative program
by derdi on Monday July 07, 2025 @03:32PM
(#44493843)
> For UINT_MAX, the algorithm would need to be reconsidered, though, since it's written with signed integers in mind.
The algorithm is written assuming that unary - produces the additive inverse. That is also true for C's unsigned integers. -1U == UINT_MAX, -UINT_MAX == 1U. It Just Works.
The algorithm is written assuming that unary - produces the additive inverse. That is also true for C's unsigned integers. -1U == UINT_MAX, -UINT_MAX == 1U. It Just Works.