* [PATCH] doc: Add explanation of zero-length array example
@ 2023-04-26 16:15 Jonathan Wakely
2023-04-27 7:24 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2023-04-26 16:15 UTC (permalink / raw)
To: gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] doc: Add explanation of zero-length array example
2023-04-26 16:15 [PATCH] doc: Add explanation of zero-length array example Jonathan Wakely
@ 2023-04-27 7:24 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-04-27 7:24 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-patches
On Wed, Apr 26, 2023 at 6:16 PM Jonathan Wakely via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> As suggested here:
> https://gcc.gnu.org/pipermail/gcc/2023-April/241190.html
>
> OK for trunk?
OK
> -- >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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-27 7:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 16:15 [PATCH] doc: Add explanation of zero-length array example Jonathan Wakely
2023-04-27 7:24 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).