lkml.org 
[lkml]   [2022]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr
From
Date
On Mon, 2022-02-28 at 20:16 +0000, Matthew Wilcox wrote:
> On Mon, Feb 28, 2022 at 12:10:24PM -0800, Linus Torvalds wrote:
> > We can do
> >
> > typeof(pos) pos
> >
> > in the 'for ()' loop, and never use __iter at all.
> >
> > That means that inside the for-loop, we use a _different_ 'pos' than outside.
>
> Then we can never use -Wshadow ;-( I'd love to be able to turn it on;
> it catches real bugs.
>

I was just going to say the same thing...

If we're willing to change the API for the macro, we could do

list_for_each_entry(type, pos, head, member)

and then actually take advantage of -Wshadow?

johannes

\
 
 \ /
  Last update: 2022-02-28 21:30    [W:0.268 / U:3.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site