Re: [PATCH 05/12] getpwent_r.3: Cast 'uid_t' to 'intmax_t' for printf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Alex,

On Sun, 13 Sep 2020 at 10:29, Alejandro Colomar <colomar.6.4.3@xxxxxxxxx> 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/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux