Patrick Steinhardt <ps@xxxxxx> writes: > 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. > Clang does have '-Wcomma' [1], which seems to be exactly what we want. [1]: https://clang.llvm.org/docs/DiagnosticsReference.html#wcomma > Thanks! > > Patrick
Attachment:
signature.asc
Description: PGP signature