[PATCH v2 0/6] Enable warnings about use of comma operator
Stephen Hemminger
stephen at networkplumber.org
Fri Aug 15 18:15:31 CEST 2025
On Fri, 15 Aug 2025 08:40:58 +0200
Morten Brørup <mb at smartsharesystems.com> wrote:
> > From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> > Sent: Thursday, 14 August 2025 23.29
> >
> > This series was motivated by recent thread on netdev
> > about build with -Wcomma in clang. This warning catches code
> > that uses comma where a semi-colon is a better choice.
>
> Overall, I agree that using semicolon is better for consistency is most places, but using commas in some loops - e.g. "for (dst=,src=; condition; dst+=, src+=)" - might be more readable than the alternative.
The compiler only warns for standalone statements, it handles the case of for(i=0,j=0;i < n; i++, j++) with out
warnings.
>
> Stephen, I'm interested in the discussion about this, can you please post a link to the thread on the netdev mailing list?
>
There is not a single thread, Simon sent patches for Intel and Nvidia drivers that have been merged.
https://marc.info/?l=linux-netdev&m=170280627225075&w=2
More information about the dev
mailing list