From: Paul Eggert <eggert@cs.ucla.edu>
To: "Carlos L. via GitGitGadget" <gitgitgadget@gmail.com>
Cc: "Martin Ågren [ ]" <martin.agren@gmail.com>,
"Carlos L." <00xc@protonmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] grep: add --max-count command line option
Date: Mon, 20 Jun 2022 10:57:40 -0500 [thread overview]
Message-ID: <449bede6-82b0-72ef-300d-bc0c49a1858b@cs.ucla.edu> (raw)
In-Reply-To: <pull.1278.git.git.1655740174420.gitgitgadget@gmail.com>
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.
next prev parent reply other threads:[~2022-06-20 15:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 15:49 [PATCH] grep: add --max-count command line option Carlos L. via GitGitGadget
2022-06-20 15:57 ` Paul Eggert [this message]
2022-06-20 16:25 ` Carlos L.
2022-06-20 16:32 ` Paul Eggert
2022-06-21 5:36 ` [PATCH v2] " Carlos L. via GitGitGadget
2022-06-21 16:27 ` Junio C Hamano
2022-06-22 6:41 ` Carlos L.
2022-06-22 6:56 ` Junio C Hamano
[not found] ` <220622.86mte5knbe.gmgdl@evledraar.gmail.com>
2022-06-22 13:23 ` Carlos L.
2022-06-22 17:07 ` [PATCH v3 0/2] " Carlos L. via GitGitGadget
2022-06-22 17:07 ` [PATCH v3 1/2] " Carlos López via GitGitGadget
2022-06-22 17:07 ` [PATCH v3 2/2] tests: add tests for grep --max-count Carlos López via GitGitGadget
2022-06-22 18:10 ` Junio C Hamano
2022-06-22 19:47 ` [PATCH v4] grep: add --max-count command line option Carlos L. via GitGitGadget
-- strict thread matches above, loose matches on Subject: below --
2022-05-12 13:20 [PATCH] " Carlos L. via GitGitGadget
2022-05-14 18:16 ` Martin Ågren
2022-05-16 5:57 ` Junio C Hamano
2022-05-16 7:28 ` Paul Eggert
2022-05-16 8:38 ` Carlos L.
2022-05-16 15:36 ` Junio C Hamano
2022-05-17 5:53 ` Paul Eggert
2022-05-16 15:18 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=449bede6-82b0-72ef-300d-bc0c49a1858b@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=00xc@protonmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=martin.agren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).