Re: AC_SYS_LARGEFILE

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

 





On 21.09.2023 0:49, Paul Eggert wrote:
On 2023-09-20 05:52, Evgeny Grin wrote:
If you need have a function with "file offset" argument then use either 'uint64_t'

Although your other advice is good, this one is suspect. I'm glad I didn't follow similar advice to use 'int32_t' or 'long' for file offsets back in the day.

Most probably 9 petabytes limitation (int64_t) would be sufficient for direct file addressing for the next two decades or a bit longer. Your public API will likely evolve by this time, and you'll add new functionality as needed.

Also, to be pedantic, the types int64_t and uint64_t are optional in POSIX, and portable programs shouldn't use them unconditionally.

Yes, '[u]int64_t' is optional. Actually, '[u]int32_t' is optional too (according to C99), so a very portable programs may avoid it as well. However, in practice, any modern platform supports it, so if you want to limit your portability to realistic scenarios, you may safely use them.

For higher portability you may use '[u]int_least32_t' and '[u]int_least64_t', both are mandatory.

--
Evgeny



Attachment: OpenPGP_0x460A317C3326D2AE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux