Re: [PATCH v2 06/10] iio: adc: ad7476: Drop convstart chan_spec
From: Matti Vaittinen
Date: Fri Aug 08 2025 - 09:30:12 EST
On 08/08/2025 15:52, Andy Shevchenko wrote:
On Fri, Aug 8, 2025 at 7:38 AM Matti Vaittinen <mazziesaccount@xxxxxxxxx> wrote:
On 08/08/2025 00:16, Andy Shevchenko wrote:
On Thu, Aug 7, 2025 at 11:35 AM Matti Vaittinen
<mazziesaccount@xxxxxxxxx> wrote:
...
+ BUILD_BUG_ON(ARRAY_SIZE(st->channel) != ARRAY_SIZE(chip_info->channel));
We have static_assert(). Why can't it be used?
Don't know. Can you please enlighten me why one is preferred over the other?
Despite already made changes, I answer to this. The static_assert()
has at least two benefits over BUILD_BUG_ON():
- it can be declared in a global scope
- it produces more condensed (to the point) error message
That's why in general it's preferable over BUILD_BUG_ON().
Thanks. It's always good to learn something new. One of the great things
when working upstream :) (Although neither of those points seem to make
a big difference here. Oh, and AFAIR, there was a variant of
BUILD_BUG_ON which allows you to add a message(?))
Yours,
-- Matti