Re: [PATCH v1 2/2] io_uring: uapi: Don't use a zero-size array

From: Jens Axboe
Date: Tue Nov 15 2022 - 18:09:40 EST


On 11/15/22 2:29 PM, Ammar Faizi wrote:
> From: Ammar Faizi <ammarfaizi2@xxxxxxxxxxx>
>
> Don't use a zero-size array because it doesn't allow the user to
> compile an app that uses liburing with the `-pedantic-errors` flag:
>
> io_uring.h:611:28: error: zero size arrays are an extension [-Werror,-Wzero-length-array]
>
> Replace the array size from 0 to 1.
>
> - No functional change is intended.
> - No struct/union size change.

The only reason why they don't grow the struct, is because it's in
a union. I don't like this patch, as the zero sized array is a clear
sign that this struct has data past it. If it's a single entry, that's
very different.

Yes that apparently makes pendantic errors unhappy, but I care more
about the readability of it.

--
Jens Axboe