From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=BAYES_00,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: C time_t 2038 problem s-os_lib.ads Date: Fri, 24 Sep 2021 12:44:38 +0300 Organization: Tidorum Ltd Message-ID: References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com> <4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com> <874kabm5mp.fsf@nosuchdomain.example.com> <3c0272f8-4117-46a4-9051-5419d1edfdc6n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net UYj5n/Xxh8o4Zmkh4GB3igSMdcCQcmoRZV3DlfEnkC0iwWIAXv Cancel-Lock: sha1:ZXTW3UwWx1VS0v2UvOgaWy+6Xko= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <3c0272f8-4117-46a4-9051-5419d1edfdc6n@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62834 List-Id: On 2021-09-24 12:32, Joakim Strandberg wrote: >> In C and C++, int is required to be at least 16 bits (POSIX >> requires 32), long is at least 32 bits, and long long is at least >> 64 bits. On most 64-bit Linux-based systems, int is 32 bits, and >> long and long long are both 64 bits. On 64-bit MS Windows, int and >> long are both 32 bits, and long long is 64 bits. time_t is 64 bits >> on almost all 64-bit systems. I've never seen a 128-bit time_t; 64 >> bits with 1-second resolution is good for several hundred billion >> years. > > Thanks for the summary of different types of integers on different > platforms Keith. When I wrote above I had simply done a quick Google > search and found > https://www.tutorialspoint.com/what-is-long-long-in-c-cplusplus where > it said "On Linux environment the long takes 64-bit (8-bytes) of > space, and the long long takes 128-bits (16-bytes) of space." I have > never seen 128-bit integers either but have seen on the development > log on AdaCore's website that support for 128-bit integers have been > added to the Interfaces package (Interfaces.Integer_128 and > Interfaces.Unsigned_128). Good that they have been added. > I believe they are part of the new Ada2022 standard. I believe not. The draft Ada2022 RM still requires no specific integer widths in section B.2, "The Package Interfaces". As in earlier standards, it still says: "An implementation shall provide the following declarations in the visible part of package Interfaces: - Signed and modular integer types of n bits, if supported by the target architecture, for each n that is at least the size of a storage element and that is a factor of the word size. The names of these types are of the form Integer_n for the signed types, and Unsigned_n for the modular types" The change by AdaCore probably reflects the fact that gcc now supports 128-bit integers on common platforms. Wikipedia has a summary: https://en.wikipedia.org/wiki/128-bit_computing.