This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Using array_length macro outside function
On Mon, 4 Feb 2019, Florian Weimer wrote:
> Do not use a statement expression and _Static_assert in array_length,
> so that array_length can be used at file scope and as a constant
> expression.
>
> The compiler error message looks like this, so this is still
> acceptable:
>
> t.c:3:28: error: zero width for bit-field ‘ARGUMENT_NOT_AN_ARRAY’
> 0 * sizeof (struct { int ARGUMENT_NOT_AN_ARRAY: \
You can use _Static_assert inside a struct; you don't need to do things
with bit-field sizes.
--
Joseph S. Myers
joseph@codesourcery.com