Re: [RFT PATCH v3 10/10] iio: Don't silently expect attribute types

From: Andy Shevchenko
Date: Mon Oct 03 2022 - 05:46:02 EST


On Mon, Oct 03, 2022 at 11:58:35AM +0300, Matti Vaittinen wrote:
> On 10/3/22 11:43, Andy Shevchenko wrote:
> > On Mon, Oct 03, 2022 at 11:13:53AM +0300, Matti Vaittinen wrote:

...

> > > + for (i = 0, id_attr = buffer->attrs[i];
> > > + (id_attr = buffer->attrs[i]); i++)
> >
> > Not sure why we have additional parentheses...
>
> Because gcc warns about the assignment and suggests adding parenthesis if we
> don't.

Ah, this is a condition, so that's why compiler wants to have a _result_ of
the assignment and not the ambiguous thingy.

Btw, have you considered to switch to in-loop iterator definitions as we do
in many other places? Also, it might make sense to introduce for_each_...
type of macro helper if the loop is used more than once.

--
With Best Regards,
Andy Shevchenko