git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/5] CodingGuidelines: update for C99

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 7, 2022, 18:08 UTC
Message-ID
<xmqqa667fqvt.fsf@gitster.g>
In-Reply-To
<patch-1.5-5ea53989486-20221007T092505Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 35 quoted lines
> Since 7bc341e21b5 (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 <avarab@gmail.com>
> ---
>  Documentation/CodingGuidelines | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index 9fca21cc5f9..386ca0a0d22 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -204,10 +204,14 @@ For C programs:
>     by e.g. "echo DEVELOPER=1 >>config.mak".
>  
>   - We try to support a wide range of C compilers to compile Git with,
> -   including old ones.  You should not use features from newer C
> +   including old ones.  As of Git v2.35.0 Git requires C99 (we check
> +   "__STDC_VERSION__"). You should not use features from a newer C
>     standard, even if your compiler groks them.
>  
> -   There are a few exceptions to this guideline:
> +   New C99 features have been phased in gradually, if something's new
> +   in C99 but not used yet don't assume that it's safe to use, some
> +   compilers we target have only partial support for it. These are
> +   considered safe to use:
>  
>     . since early 2012 with e1327023ea, we have been using an enum
>       definition whose last element is followed by a comma.  This, like
Looking good.
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 of 22 in “CodingGuidelines: various C99 updates”
  1. 0/5 CodingGuidelines: various C99 updatesÆvar Arnfjörð Bjarmason, Oct 7, 2022
  2. 1/5 CodingGuidelines: update for C99Ævar Arnfjörð Bjarmason, Oct 7, 2022
  3. Junio C HamanoOct 7, 2022
  4. 2/5 CodingGuidelines: mention dynamic C99 initializer elementsÆvar Arnfjörð Bjarmason, Oct 7, 2022
  5. 3/5 CodingGuidelines: allow declaring variables in for loopsÆvar Arnfjörð Bjarmason, Oct 7, 2022
  6. Junio C HamanoOct 7, 2022
  7. 4/5 CodingGuidelines: mention C99 features we can't useÆvar Arnfjörð Bjarmason, Oct 7, 2022
  8. Junio C HamanoOct 7, 2022
  9. 5/5 CodingGuidelines: recommend against unportable C99 struct syntaxÆvar Arnfjörð Bjarmason, Oct 7, 2022
  10. Junio C HamanoOct 7, 2022
  11. Junio C HamanoOct 7, 2022
  12. 0/5 CodingGUidelines: C99 updatesJunio C Hamano, Oct 10, 2022
  13. 1/5 CodingGuidelines: update for C99Junio C Hamano, Oct 10, 2022
  14. 2/5 CodingGuidelines: mention dynamic C99 initializer elementsJunio C Hamano, Oct 10, 2022
  15. 3/5 CodingGuidelines: allow declaring variables in for loopsJunio C Hamano, Oct 10, 2022
  16. 4/5 CodingGuidelines: mention C99 features we can't useJunio C Hamano, Oct 10, 2022
  17. 5/5 CodingGuidelines: recommend against unportable C99 struct syntaxJunio C Hamano, Oct 10, 2022
  18. Jeff KingOct 11, 2022
  19. Junio C HamanoOct 11, 2022
  20. Jeff KingOct 11, 2022
  21. Ævar Arnfjörð BjarmasonOct 11, 2022
  22. Junio C HamanoOct 11, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.