Re: [PATCH 0/2] Avoid the comma operator
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 25, 2025, 19:34 UTC
- Message-ID
- <xmqqh63gnbum.fsf@gitster.g>
- In-Reply-To
- <pull.1889.git.1742889711.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 9 quoted lines
> The comma operator > [https://en.cppreference.com/w/c/language/operator_other#Comma_operator] is > rarely used in C anymore, and typically indicates a typo. Just like in these > instances, where a semicolon was meant to be used, as there is no need to > discard the first statement's result here. > > Johannes Schindelin (2): > remote-curl: avoid using the comma operator unnecessarily > rebase: avoid using the comma operator unnecessarily
Well spotted.
These two looked somehow surprisingly bad.
If I hadn't known better, I may have spent quite some time wondering if these are some ways to hide an unexpected behaviour behind the differences between a comma and a semicolon for nefarious purposes.
Will queue. Thanks.
Show 10 quoted lines
> > builtin/rebase.c | 2 +- > remote-curl.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > > base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1889%2Fdscho%2Fcomma-operator-v1 > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1889/dscho/comma-operator-v1 > Pull-Request: https://github.com/gitgitgadget/git/pull/1889