Skip to content

Commit 9b2527c

Browse files
committed
CodingGuidelines: document test balloons in flight
Due to portability concerns, we do not blindly say "It is in [[this standard]], so we will make liberal use of it" for many features, and use of C99 language features follow this same principle. When we contemplate adopting a language feature that we haven't used in our codebase, we typically first raise a test balloon, which - is a piece of code that exercises the language feature we are trying to see if it is OK to adopt - is in a small section of code that we know everybody who cares about having a working Git must be compiling - is in a fairly stable part of the code, to allow reverting it easily if some platforms do not understand it yet. After a few years, with no breakage report from the community, we'd declare that the feature is now safe to use in our codebase. Before that, we forbid the use of the language construct except for the designated test balloon code site. The CodingGuidelines document lists these selected features that we already have determined that they are safe, and also those features that we know some platforms had trouble with. Let's also start listing ongoing test balloons and expected timeline for adoption. Recently phillip proposed to adopt the syntax to spell a structure literally (i.e. compound literal) with a new test balloon, which Patrick made redundant by pointing out an existing one we had already.but without documenting it. Start the new section with an entry for that test balloon. Helped-by: Patrick Steinhardt <[email protected]> Helped-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16bd9f2 commit 9b2527c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Documentation/CodingGuidelines

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ For C programs:
298298
. since late 2021 with 44ba10d6, we have had variables declared in
299299
the for loop "for (int i = 0; i < 10; i++)".
300300

301+
C99 features we have test balloons for:
302+
303+
. since late 2024 with v2.48.0-rc0~20, we have test balloons for
304+
compound literal syntax, e.g., (struct foo){ .member = value };
305+
our hope is that no platforms we care about have trouble using
306+
them, and officially adopt its wider use in mid 2026. Do not add
307+
more use of the syntax until that happens.
308+
301309
New C99 features that we cannot use yet:
302310

303311
. %z and %zu as a printf() argument for a size_t (the %z being for

0 commit comments

Comments
 (0)