From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id ADBBF385841E for ; Wed, 26 Apr 2023 16:15:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADBBF385841E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682525742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HRjXUni25xdZpW9HabYO7X+iU7Fnk1TJ6nRvdYRZNNg=; b=DTDlUf2IvivDTiMWXapwSy24bKsW3uCyqVQ/3cXwxPVQh3HYEa98qV+8KF1pKy+eqEy/Dv PeqRbKRf2pJQmPGYoQUeHAqap7KcyzfJ8s9PmVFCHD5xFMdRbSXDgmfgCVGDWyRFEA0RV9 Xv2jL27R/anNsSZTMHEW1sq9KV9mAOc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-85-bkzMsIBxNy6uTi1H6kF4MQ-1; Wed, 26 Apr 2023 12:15:41 -0400 X-MC-Unique: bkzMsIBxNy6uTi1H6kF4MQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B80E93C025C9 for ; Wed, 26 Apr 2023 16:15:40 +0000 (UTC) Received: from localhost (unknown [10.42.28.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 835F22027043 for ; Wed, 26 Apr 2023 16:15:40 +0000 (UTC) From: Jonathan Wakely To: gcc-patches@gcc.gnu.org Subject: [PATCH] doc: Add explanation of zero-length array example Date: Wed, 26 Apr 2023 17:15:39 +0100 Message-Id: <20230426161539.1571701-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: As suggested here: https://gcc.gnu.org/pipermail/gcc/2023-April/241190.html OK for trunk? -- >8 -- gcc/ChangeLog: * doc/extend.texi (Zero Length): Describe example. --- gcc/doc/extend.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 84b44cb9916..06134a50ad2 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 -- 2.40.0