Re: [PATCH 03/12] pthread_getcpuclockid.3: Cast 'time_t' to 'intmax_t' for printf()

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

 



* Michael Kerrisk <mtk.manpages@xxxxxxxxx>, 2020-09-13, 07:58:
Casting to long is the historical practive here, and should be sufficient, don't you think?

It general, the practice of casting time_t to long is wrong. There are existing systems that have 64-bit time_t but 32-bit long.

In this particular case, we're measuring CPU time, so there's practically no danger of overflow.

I'd either cast it to int (to make the code shortest and simplest) or to intmax_t (to be pedantically correct).

--
Jakub Wilk



[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