On 6/20/22 10:49, Carlos L. via GitGitGadget wrote:
+ unsigned max_count;
Why not make this intmax_t? That way, you don't have to worry about casting -1 to unsigned. Also on typical 64-bit machines you no longer have to worry about mishandling counts greater than 2**32 (the limit becomes 2**63 - 1 which is plenty).
These days it's typically better to avoid unsigned types in C when you can, as standard tools like 'gcc -fsanitize=undefined' can catch signed int overflow whereas unsigned int overflow always wraps around which is typically bad news.