From: Jonathan Wakely Date: Wed, 26 Apr 2023 16:09:36 +0000 (+0100) Subject: doc: Add explanation of zero-length array example X-Git-Tag: basepoints/gcc-15~9853 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=429c72eb632040bacef9569b6d783d72fee93b42;p=thirdparty%2Fgcc.git doc: Add explanation of zero-length array example gcc/ChangeLog: * doc/extend.texi (Zero Length): Describe example. --- diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index ac476801ed84..e426a2eb7d81 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -1705,6 +1705,9 @@ struct line *thisline = (struct line *) thisline->length = this_length; @end smallexample +In this example, @code{thisline->contents} is an array of @code{char} that +can hold up to @code{thisline->length} bytes. + Although the size of a zero-length array is zero, an array member of this kind may increase the size of the enclosing type as a result of tail padding. The offset of a zero-length array member from the beginning