On 07/07/22 22:45, Richard W.M. Jones wrote:
On Thu, Jul 07, 2022 at 03:10:19PM -0500, Eric Blake wrote:
> There's also a question of whether the error message when the
> constraint fails is going to be legible enough to give the developer a
> hint as to what they did wrong when they pass in a non-array type; but
> I'm less worried about that.
The error message when it fails is very lengthy, but also I'm not too
worried there.
Pushed as 9b3a2d6c55dac825846617cc1d10111aea1793b4.
Thanks!
I think (being a bit late to the constructive half of the party) that
BUILD_BUG_UNLESS would suffice too. That reads the best IMO:
BUILD_BUG_UNLESS (TYPE_IS_ARRAY (a)))
BTW, C11 and later have _Static_assert(), where the programmer can even
separately specify the error message to emit at compile time. I'm not
sure what we target.
Regardless, the commit is a huge improvement for readability.
(Eric, see my independent rant at
<
https://bugzilla.redhat.com/show_bug.cgi?id=2104720#c4> ;) )
Thanks!
Laszlo