From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "René Scharfe" <l.s.r@web.de>,
"Jeff King" <peff@peff.net>, "Elijah Newren" <newren@gmail.com>
Subject: Re: [PATCH 4/5] CodingGuidelines: mention C99 features we can't use
Date: Fri, 07 Oct 2022 11:13:49 -0700 [thread overview]
Message-ID: <xmqq1qrjfqn6.fsf@gitster.g> (raw)
In-Reply-To: <patch-4.5-17c2a0d88e8-20221007T092505Z-avarab@gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Fri, 7 Oct 2022 11:30:33 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> The C99 section of the CodingGuidelines is a good overview of what we
> can use, but is sorely lacking in what we can't use. Something that
> comes up occasionally is the portability of %z.
>
> Per [1] we couldn't use it for the longest time due to MSVC not
> supporting it, but nowadays by requiring C99 we rely on the MSVC
> version that does, but we can't use it yet because a C library that
> MinGW uses doesn't support it.
>
> 1. https://lore.kernel.org/git/a67e0fd8-4a14-16c9-9b57-3430440ef93c@gmail.com/
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
> Documentation/CodingGuidelines | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index f9affc4050a..893f960231f 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -235,6 +235,13 @@ For C programs:
> . since late 2021 with 44ba10d6, we have had variables declared in
> the for loop "for (int i = 0; i < 10; i++)".
>
> + New C99 features that we cannot use yet:
> +
> + . %z and %zu as a printf() argument for a size_t (the %z being for
> + the POSIX-specific ssize_t). Instead you should use
> + printf("%"PRIuMAX, (uintmax_t)v); These days the MSVC version we
> + rely on supports %z, but the C library used by MinGW does not.
> +
Good. s/; These days/; these days/, though.
next prev parent reply other threads:[~2022-10-07 18:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 9:30 [PATCH 0/5] CodingGuidelines: various C99 updates Ævar Arnfjörð Bjarmason
2022-10-07 9:30 ` [PATCH 1/5] CodingGuidelines: update for C99 Ævar Arnfjörð Bjarmason
2022-10-07 18:08 ` Junio C Hamano
2022-10-07 9:30 ` [PATCH 2/5] CodingGuidelines: mention dynamic C99 initializer elements Ævar Arnfjörð Bjarmason
2022-10-07 9:30 ` [PATCH 3/5] CodingGuidelines: allow declaring variables in for loops Ævar Arnfjörð Bjarmason
2022-10-07 18:12 ` Junio C Hamano
2022-10-07 9:30 ` [PATCH 4/5] CodingGuidelines: mention C99 features we can't use Ævar Arnfjörð Bjarmason
2022-10-07 18:13 ` Junio C Hamano [this message]
2022-10-07 9:30 ` [PATCH 5/5] CodingGuidelines: recommend against unportable C99 struct syntax Ævar Arnfjörð Bjarmason
2022-10-07 17:54 ` [PATCH 0/5] CodingGuidelines: various C99 updates Junio C Hamano
2022-10-07 18:15 ` Junio C Hamano
2022-10-10 20:37 ` [PATCH v2 0/5] CodingGUidelines: " Junio C Hamano
2022-10-10 20:37 ` [PATCH v2 1/5] CodingGuidelines: update for C99 Junio C Hamano
2022-10-10 20:37 ` [PATCH v2 2/5] CodingGuidelines: mention dynamic C99 initializer elements Junio C Hamano
2022-10-10 20:37 ` [PATCH v2 3/5] CodingGuidelines: allow declaring variables in for loops Junio C Hamano
2022-10-10 20:37 ` [PATCH v2 4/5] CodingGuidelines: mention C99 features we can't use Junio C Hamano
2022-10-10 20:38 ` [PATCH v2 5/5] CodingGuidelines: recommend against unportable C99 struct syntax Junio C Hamano
2022-10-11 0:09 ` Jeff King
2022-10-11 0:26 ` Junio C Hamano
2022-10-11 0:39 ` Jeff King
2022-10-11 8:30 ` Ævar Arnfjörð Bjarmason
2022-10-11 15:01 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1qrjfqn6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=newren@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).