Messages in this thread | | | From | Linus Torvalds <> | Date | Wed, 23 Feb 2022 12:34:18 -0800 | Subject | Re: [RFC PATCH 04/13] vfio/mdev: remove the usage of the list iterator after the loop |
| |
On Wed, Feb 23, 2022 at 12:19 PM Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote: > > I have often wished that the iterator macros would consistently set the > loop variable to NULL upon reaching the end.
I really think the rule should be that to a 99% approximation, we should strive only ever use the iterated-upon value *inside* the loop.
No, that's now how we do it now. But I think the "break out and do the work outside the loop" case is kind of broken anyway. It makes you test the condition twice - and while a compiler might be smart enough to optimize the second test away, it's still just plain ugly.
Linus
| |