From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 034123858D32; Thu, 27 Apr 2023 08:56:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 034123858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682585774; bh=G1LrtNXq6YMUttRcqSnAyTtCI5/1tBEYBYAwbAP+PQw=; h=From:To:Subject:Date:From; b=DQo8GRGTS67jhwLLi+6WVauQ9PGFEn5Nm+KZr6/mC3QP/7e3p5FKDzP2u2b9s6Poe sHdEfR0dWp9tpVMoOWFb6YY1FgtDdh4f4zyJUssc3MxVpZ+C8Lys4cmb7UFH2BXru7 GhGQoN/ibZ1c0yD3WcL2AmBMknKCR5/dyrCfKB1c= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-286] doc: Add explanation of zero-length array example X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 7bcdcf86e8272eeb524cc1dcb0ada8c8cfe6f27e X-Git-Newrev: 429c72eb632040bacef9569b6d783d72fee93b42 Message-Id: <20230427085614.034123858D32@sourceware.org> Date: Thu, 27 Apr 2023 08:56:14 +0000 (GMT) List-Id: https://gcc.gnu.org/g:429c72eb632040bacef9569b6d783d72fee93b42 commit r14-286-g429c72eb632040bacef9569b6d783d72fee93b42 Author: Jonathan Wakely Date: Wed Apr 26 17:09:36 2023 +0100 doc: Add explanation of zero-length array example gcc/ChangeLog: * doc/extend.texi (Zero Length): Describe example. Diff: --- gcc/doc/extend.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index ac476801ed8..e426a2eb7d8 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