From: Paul Eggert Date: Mon, 20 Jun 2022 15:57:40 GMT Subject: Re: [PATCH] grep: add --max-count command line option Message-ID: <449bede6-82b0-72ef-300d-bc0c49a1858b@cs.ucla.edu> In-Reply-To: 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.