public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks•im>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] 3.0: require C99 flexible-array member syntax
Date: Fri, 12 Dec 2025 09:36:00 +0100	[thread overview]
Message-ID: <aTvT8A31tQFvCvtL@pks.im> (raw)
In-Reply-To: <xmqqbjk5e32q.fsf@gitster.g>

On Thu, Dec 11, 2025 at 07:16:13PM +0900, Junio C Hamano wrote:
> Before C99 syntax to express that the final member in a struct is an
> array of unknown number of elements, i.e.,
> 
> 	struct {
> 		...
> 		T flexible_array[];
> 	};
> 
> came along, GNU introduced their own extension to declare such a
> member with 0 size, i.e.,
> 
> 		T flexible_array[0];
> 
> and the compilers that did not understand even that were given a way
> to emulate it by wasting one element, i.e.,
> 
> 		T flexible_array[1];
> 
> As we are pushing more and more C99 language features, let's declare
> the historical forms of flexible array member support obsolete and
> require C99 syntax from all compilers that want to compile Git.

Is there any specific reason why this is tied to the 3.0 breaking
changes document? I would have expected that we introduce this change
via a test balloon like we usually do for new C features that we haven't
used before. And we already are using C99 features, so I wouldn't
consider this change to be "more breaking" than any of the other C99
features we have introduced already.

So I wonder whether we should instead convert one of the sites that
currently uses FLEX_ARRAY to use C99 flexible arrays unconditionally. On
the other hand we don't really gain much by doing that, as it is just as
easy to adapt the FLEX_ARRAY definitions to unconditionally use C99
flexible arrays. Both would boil down to a couple lines of changes,
only.

If we see that any platform out there doesn't support this feature we
can still roll back and maybe tie it to Git 3.0.

Thanks!

Patrick

  reply	other threads:[~2025-12-12  8:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 10:16 [PATCH] 3.0: require C99 flexible-array member syntax Junio C Hamano
2025-12-12  8:36 ` Patrick Steinhardt [this message]
2025-12-12 12:54   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTvT8A31tQFvCvtL@pks.im \
    --to=ps@pks$(echo .)im \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox