All of lore.kernel.org
 help / color / mirror / Atom feed
From: Derrick Stolee <derrickstolee@github.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH 1/2] gettext API users: correct use of casts for Q_()
Date: Mon, 7 Mar 2022 08:41:48 -0500	[thread overview]
Message-ID: <a34c37c0-b6fd-9f4f-e990-9869f375937e@github.com> (raw)
In-Reply-To: <patch-1.2-83659fbc459-20220307T113707Z-avarab@gmail.com>

On 3/7/2022 6:38 AM, Ævar Arnfjörð Bjarmason wrote:
> Change users of the inline gettext.h Q_() function to cast its
> argument to "unsigned long" instead of "int" or "unsigned int".
> 
> The ngettext() function (which Q_() resolves to) takes an "unsigned
> long int", and so does our Q_() wrapper for it, see 0c9ea33b90f (i18n:
> add stub Q_() wrapper for ngettext, 2011-03-09).
> 
> In a subsequent commit we'll be making more use of this pattern of:
> 
>     func(Q_(..%"PRIuMAX..., (unsigned long)x), (uintmax_t)x);
> 
> By making this change we ensure that this case isn't the odd one out
> in that post-image.


>  	if (!res)
> -		printf(Q_("updated %d path\n",
> -			  "updated %d paths\n", count), (int)count);
> +		printf(Q_("updated %"PRIuMAX" path\n",
> +			  "updated %"PRIuMAX" paths\n", (unsigned long)count),
> +		       (uintmax_t)count);

Why are we adding more uses of "unsigned long" which is not consistent
in its size across 64-bit Linux and 64-bit Windows? Specifically, on
Windows "unsigned long" is _not_ uintmax_t. Shouldn't we be using
uintmax_t everywhere instead?

Thanks,
-Stolee

  reply	other threads:[~2022-03-07 13:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 11:37 [PATCH 0/2] string-list.h: make "nr" and "alloc" a "size_t" Ævar Arnfjörð Bjarmason
2022-03-07 11:38 ` [PATCH 1/2] gettext API users: correct use of casts for Q_() Ævar Arnfjörð Bjarmason
2022-03-07 13:41   ` Derrick Stolee [this message]
2022-03-07 13:54     ` Ævar Arnfjörð Bjarmason
2022-03-07 15:53       ` Derrick Stolee
2022-03-07 11:38 ` [PATCH 2/2] string-list API: change "nr" and "alloc" to "size_t" Ævar Arnfjörð Bjarmason
2022-03-07 13:43   ` Derrick Stolee
2022-03-07 14:10     ` Ævar Arnfjörð Bjarmason
2022-03-07 15:27 ` [PATCH v2 0/2] string-list.h: make "nr" and "alloc" a "size_t" Ævar Arnfjörð Bjarmason
2022-03-07 15:27   ` [PATCH v2 1/2] gettext API users: don't explicitly cast ngettext()'s "n" Ævar Arnfjörð Bjarmason
2022-03-07 15:27   ` [PATCH v2 2/2] string-list API: change "nr" and "alloc" to "size_t" Ævar Arnfjörð Bjarmason
2022-03-07 16:23     ` Philip Oakley
2022-03-07 20:43       ` Junio C Hamano
2022-03-07 23:34         ` Philip Oakley
2022-03-07 15:55   ` [PATCH v2 0/2] string-list.h: make "nr" and "alloc" a "size_t" Derrick Stolee

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=a34c37c0-b6fd-9f4f-e990-9869f375937e@github.com \
    --to=derrickstolee@github.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.