Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: sizeof struct with flexible array: when did it change?
Date: Sun, 06 Oct 2024 20:43:52 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <86y130zifb.fsf@linuxsc.com>
References: <20241006192337.76@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 07 Oct 2024 05:43:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a62c12983f398f111226e581353fb46e"; logging-data="1673085"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rcmU5RTiPLlzjrhUHgzOjS+gb+9spPz4="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:0oUK1Ab2PF+H9hH+w5w+IlBhY/Q= sha1:mPkGAKiPS+yT0X63yXwvBqk6JHU=
Xref: csiph.com comp.lang.c:388584
Kaz Kylheku <643-408-1753@kylheku.com> writes:
> C99 said that the size of a structure that ends in a flexible array
> member is the same as the offset of that flexible member in a
> similar structure in which the array has some unspecified size.
>
> The latest draft says that the size is calculated as if the flexible
> array member were omitted, except that there may be more padding than
> the omission would imply.
The change was made in a TC to C99, sometime in the early
2000s. (No I don't know which TC specifically, but the
wording change can be seen in N1256.)