Re: [PATCH v1 5/5] pinctrl: intel: define iterator variables inside for-loop
From: Mika Westerberg
Date: Thu Mar 19 2026 - 06:42:05 EST
On Thu, Mar 19, 2026 at 09:20:51AM +0200, Andy Shevchenko wrote:
> On Thu, Mar 19, 2026 at 08:09:25AM +0100, Mika Westerberg wrote:
> > On Thu, Mar 19, 2026 at 08:57:58AM +0200, Andy Shevchenko wrote:
> > > On Thu, Mar 19, 2026 at 07:02:21AM +0100, Mika Westerberg wrote:
> > > > On Wed, Mar 18, 2026 at 04:10:19PM +0100, Andy Shevchenko wrote:
>
> ...
>
> > > > > - int i;
> > > >
> > > > If there are multiple loops, I prefer to declare the variable outside of
> > > > them.
> > >
> > > Why?! It's exactly where it make even more sense to hide.
> >
> > I disagree.
>
> Why? Can you give a constructive feedback, please?
I think I did already.
If you have just a single loop it's okay. If multiple then it makes more
sense to declare the variable in the outer scope. This is at least what I'm
used to do and prefer here as well.