Re: [PATCH 0/2] Avoid the comma operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 25, 2025 at 08:01:48AM +0000, Johannes Schindelin via GitGitGadget wrote:
> 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.

The changes look obviously good to me, thanks. The reftable library and
backend also had several instances where the operator was used by
accident, and I've gotten rid of those over time. They typically don't
do any harm as the result is essentially the same, but sometimes they
may cause issues. And at the very least they cause confusion.

It would be great if there was a compiler warning we could enable for
cases where the operator likely isn't intentional. But I couldn't find
any, unfortunately.

Thanks!

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux