Skip to content

Commit e88a2d0

Browse files
avargitster
authored andcommitted
CodingGuidelines: update for C99
Since 7bc341e (git-compat-util: add a test balloon for C99 support, 2021-12-01) we've had a hard dependency on C99, but the prose in CodingGuidelines was written under the assumption that we were using C89 with a few C99 features. As the updated prose notes we'd still like to hold off on novel C99 features, but let's make it clear that we target that C version, and then enumerate new C99 features that are safe to use. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3dcec76 commit e88a2d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Documentation/CodingGuidelines

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,14 @@ For C programs:
204204
by e.g. "echo DEVELOPER=1 >>config.mak".
205205

206206
- We try to support a wide range of C compilers to compile Git with,
207-
including old ones. You should not use features from newer C
207+
including old ones. As of Git v2.35.0 Git requires C99 (we check
208+
"__STDC_VERSION__"). You should not use features from a newer C
208209
standard, even if your compiler groks them.
209210

210-
There are a few exceptions to this guideline:
211+
New C99 features have been phased in gradually, if something's new
212+
in C99 but not used yet don't assume that it's safe to use, some
213+
compilers we target have only partial support for it. These are
214+
considered safe to use:
211215

212216
. since early 2012 with e1327023ea, we have been using an enum
213217
definition whose last element is followed by a comma. This, like

0 commit comments

Comments
 (0)