All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Alejandro Colomar <colomar.6.4.3@gmail.com>
Cc: linux-man <linux-man@vger.kernel.org>
Subject: Re: [PATCH 05/12] getpwent_r.3: Cast 'uid_t' to 'intmax_t' for printf()
Date: Sun, 13 Sep 2020 14:04:39 +0200	[thread overview]
Message-ID: <CAKgNAkigmNbw5uq47dgwCs3jGgHOu_Ce-A9mehGdvpFhMn9_1A@mail.gmail.com> (raw)
In-Reply-To: <b686b723-1daf-54ac-db56-2b45021b40e2@gmail.com>

Hello Alex,

On Sun, 13 Sep 2020 at 10:29, Alejandro Colomar <colomar.6.4.3@gmail.com> wrote:
>
> Hi Michael,
>
> On 9/13/20 8:01 AM, Michael Kerrisk (man-pages) wrote:
> > Casting to long is the historical practice here, and should be sufficient,
> > don't you think? I realize there's an argument for making all of these
> > system data type casts intmax_t / uintmax_t. But the counterarguments
> > (admittedly not compelling), are:
>
> I was casting to (long) until I accidentally met with a cast to
> (intmax_t) in ftw.3 (now I realize it was the only one in all of the
> pages; lucke me).

Yep, that was a bit of a coincidence!

> I saw there a good point in using those types and tried it to see what
> you think about them.  I still haven't sent you a big patchset with
> s/(long)/(intmax_t)/ because I was waiting for this discussion :)

:-).

> > * Some people might still be confined to a pre C-99 world
>
> I guess that people are dealing with very special hardware/software
> and can be trusted to understand what the C99 types are and which
> pre-C99 do the job for them; intmax_t.3 might also help ;).
>
> If someone doesn't live in such a special world and just doesn't
> know the types, it's a good moment to learn them.
>
> > * Churn (lots of changes)
>
> True ...  But if changes are trivial enough, maybe a single big patch
> can do it.

Yes.

> > * (long) is a sufficient cast for all of these types
> >   (except off_t).
>
> I don't like exceptions very much.  Maybe someone sees (long) all over
> the place and thinks 'long' is enough everywhere and misuses it.
>
> > Your thoughts?
>
> Your thoughts?

Well, I said none of my arguments was too compelling... I think that
I'd take one big patch. Perhaps first, could you send me an estimate
of how many pages you think might be changed in the patch.


Thanks,

Michael

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

  reply	other threads:[~2020-09-13 12:04 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 23:14 [PATCH 00/12] printf() fixes Alejandro Colomar
2020-09-11 23:14 ` [PATCH 01/12] dl_iterate_phdr.3: Cast 'ElfN_Word' to 'uintmax_t' for printf() Alejandro Colomar
2020-09-12  5:52   ` Jakub Wilk
2020-09-12  8:31     ` Alejandro Colomar
2020-09-15  7:35       ` Jakub Wilk
2020-09-15  9:27         ` Alejandro Colomar
2020-09-11 23:14 ` [PATCH 02/12] malloc_hook.3: Remove unneeded cast, and print 'size_t' with "%zu" Alejandro Colomar
2020-09-13  5:46   ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 03/12] pthread_getcpuclockid.3: Cast 'time_t' to 'intmax_t' for printf() Alejandro Colomar
2020-09-13  5:58   ` Michael Kerrisk (man-pages)
2020-09-13  6:05     ` Michael Kerrisk (man-pages)
2020-09-13  8:12       ` Alejandro Colomar
2020-09-13 12:04         ` Michael Kerrisk (man-pages)
2020-09-14  8:58     ` Jakub Wilk
2020-09-14 19:38       ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 04/12] getgrent_r.3: Cast 'gid_t' " Alejandro Colomar
2020-09-13  6:01   ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 05/12] getpwent_r.3: Cast 'uid_t' " Alejandro Colomar
2020-09-13  6:01   ` Michael Kerrisk (man-pages)
2020-09-13  8:28     ` Alejandro Colomar
2020-09-13 12:04       ` Michael Kerrisk (man-pages) [this message]
2020-09-13 13:28         ` Alejandro Colomar
2020-09-13 18:11         ` Alejandro Colomar
2020-09-11 23:14 ` [PATCH 06/12] rtld-audit.7: Use "%u" rather than "%d" when printing 'unsigned int' values Alejandro Colomar
2020-09-13  5:46   ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 07/12] userfaultfd.2: Use 'PRIx64' rather than "%llx" when printing 64-bit fixed-width types Alejandro Colomar
2020-09-13  5:51   ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 08/12] clock_getres.2: Cast 'time_t' to 'intmax_t' for printf() and fix the length modifiers Alejandro Colomar
2020-09-12  5:55   ` Jakub Wilk
2020-09-12  8:32     ` Alejandro Colomar
2020-09-12 10:06       ` [PATCH v2 08/12] clock_getres.2: Cast 'time_t' very small,values to 'int' " Alejandro Colomar
2020-09-13  6:05         ` Michael Kerrisk (man-pages)
2020-09-14  9:11         ` Jakub Wilk
2020-09-14  9:48           ` Alejandro Colomar
2020-09-11 23:14 ` [PATCH 09/12] open_by_handle_at.2: Use "%u" rather than "%d" when printing 'unsigned int' values Alejandro Colomar
2020-09-13  5:46   ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 10/12] spu_run.2: Cast 'int' to 'unsigned int' when printing with "%x" Alejandro Colomar
2020-09-12 10:29   ` Alejandro Colomar
2020-09-13  5:54     ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 11/12] mprotect.2: Use "%p" rather than casting to 'long' when printing adresses (pointer values) Alejandro Colomar
2020-09-13  5:46   ` Michael Kerrisk (man-pages)
2020-09-11 23:14 ` [PATCH 12/12] pidfd_open.2: Cast 'short' to 'unsigned int' when printing with "%x" Alejandro Colomar
2020-09-13  5:55   ` Michael Kerrisk (man-pages)
2020-09-13  8:06     ` Alejandro Colomar

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=CAKgNAkigmNbw5uq47dgwCs3jGgHOu_Ce-A9mehGdvpFhMn9_1A@mail.gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=colomar.6.4.3@gmail.com \
    --cc=linux-man@vger.kernel.org \
    /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.