Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"The way of the world is to praise dead saints and prosecute live ones." -- Nathaniel Howe


devel / comp.lang.ada / C time_t 2038 problem s-os_lib.ads

SubjectAuthor
* C time_t 2038 problem s-os_lib.adsKevin Chadwick
`* Re: C time_t 2038 problem s-os_lib.adsJeffrey R. Carter
 `* Re: C time_t 2038 problem s-os_lib.adsKevin Chadwick
  `* Re: C time_t 2038 problem s-os_lib.adsJoakim Strandberg
   +* Re: C time_t 2038 problem s-os_lib.adsKevin Chadwick
   |`- Re: C time_t 2038 problem s-os_lib.adsKevin Chadwick
   `* Re: C time_t 2038 problem s-os_lib.adsKeith Thompson
    `* Re: C time_t 2038 problem s-os_lib.adsJoakim Strandberg
     +- Re: C time_t 2038 problem s-os_lib.adsNiklas Holsti
     `* Re: C time_t 2038 problem s-os_lib.adsKeith Thompson
      +- Re: C time_t 2038 problem s-os_lib.adsG.B.
      `- Re: C time_t 2038 problem s-os_lib.adsSimon Wright

1
C time_t 2038 problem s-os_lib.ads

<8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5996&group=comp.lang.ada#5996

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:98d:: with SMTP id dt13mr3628662qvb.13.1632393736537;
Thu, 23 Sep 2021 03:42:16 -0700 (PDT)
X-Received: by 2002:a05:6902:1549:: with SMTP id r9mr4717651ybu.204.1632393736290;
Thu, 23 Sep 2021 03:42:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 23 Sep 2021 03:42:16 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=84.92.86.82; posting-account=OCGnxwkAAADCyu751mus9xKbEvUSs9BP
NNTP-Posting-Host: 84.92.86.82
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
Subject: C time_t 2038 problem s-os_lib.ads
From: m8il1i...@gmail.com (Kevin Chadwick)
Injection-Date: Thu, 23 Sep 2021 10:42:16 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 8
 by: Kevin Chadwick - Thu, 23 Sep 2021 10:42 UTC

I have noticed that C time_t appears to be Long_integer in Gnat s-os_lib.ads.

Just wondering if it should be 64bit long long as OpenBSD has already moved to long long?

There seemed to be some noise on Twitter about the Linux Kernel side last year but I'm not sure if that ended up just being noise without action or not.

"https://www.openbsd.org/papers/eurobsdcon_2013_time_t/"

p.s. It's interesting that Adas type system avoids this issue mostly (ignoring leap handling pain)

Re: C time_t 2038 problem s-os_lib.ads

<sii2q2$fcn$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5998&group=comp.lang.ada#5998

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.not.acm.org (Jeffrey R. Carter)
Newsgroups: comp.lang.ada
Subject: Re: C time_t 2038 problem s-os_lib.ads
Date: Thu, 23 Sep 2021 16:26:09 +0200
Organization: Also freenews.netfront.net; news.tornevall.net;
news.eternal-september.org
Lines: 15
Message-ID: <sii2q2$fcn$1@dont-email.me>
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 23 Sep 2021 14:26:10 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="85c4627cb0e806863e9269bc32b97461";
logging-data="15767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HGpse7BxL9UZfkvRe3Wx7PvTjwpoK6HQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Cancel-Lock: sha1:QXELuhneMrXuvvdEOCpf4HJB4+A=
In-Reply-To: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R. Carter - Thu, 23 Sep 2021 14:26 UTC

On 9/23/21 12:42 PM, Kevin Chadwick wrote:
> I have noticed that C time_t appears to be Long_integer in Gnat s-os_lib.ads.
>
> Just wondering if it should be 64bit long long as OpenBSD has already moved to long long?

GNAT defines

type Long_Integer is range -(2 **63) .. +(2 **63 - 1);
for Long_Integer'Size use 64;

--
Jeff Carter
"I was either in love, or I had smallpox."
Take the Money and Run
137

Re: C time_t 2038 problem s-os_lib.ads

<4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5999&group=comp.lang.ada#5999

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:134a:: with SMTP id f10mr5246927qtj.382.1632409263434;
Thu, 23 Sep 2021 08:01:03 -0700 (PDT)
X-Received: by 2002:a05:6902:124c:: with SMTP id t12mr6129752ybu.91.1632409263265;
Thu, 23 Sep 2021 08:01:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 23 Sep 2021 08:01:03 -0700 (PDT)
In-Reply-To: <sii2q2$fcn$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=84.92.86.82; posting-account=OCGnxwkAAADCyu751mus9xKbEvUSs9BP
NNTP-Posting-Host: 84.92.86.82
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com> <sii2q2$fcn$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
Subject: Re: C time_t 2038 problem s-os_lib.ads
From: m8il1i...@gmail.com (Kevin Chadwick)
Injection-Date: Thu, 23 Sep 2021 15:01:03 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 14
 by: Kevin Chadwick - Thu, 23 Sep 2021 15:01 UTC

On Thursday, September 23, 2021 at 2:26:11 PM UTC, Jeffrey R. Carter wrote:
> On 9/23/21 12:42 PM, Kevin Chadwick wrote:
> > I have noticed that C time_t appears to be Long_integer in Gnat s-os_lib.ads.
> >
> > Just wondering if it should be 64bit long long as OpenBSD has already moved to long long?
> GNAT defines
>
> type Long_Integer is range -(2 **63) .. +(2 **63 - 1);
> for Long_Integer'Size use 64;
>

I see, thank you.

GPS doesn't seem to jump to declaration for Long_Integer and grep hasn't turned it up,
so I will just take your word for it.

Re: C time_t 2038 problem s-os_lib.ads

<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6000&group=comp.lang.ada#6000

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:746:: with SMTP id 67mr5250306qkh.465.1632409729614;
Thu, 23 Sep 2021 08:08:49 -0700 (PDT)
X-Received: by 2002:a25:8409:: with SMTP id u9mr6040328ybk.159.1632409729345;
Thu, 23 Sep 2021 08:08:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 23 Sep 2021 08:08:49 -0700 (PDT)
In-Reply-To: <4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=136.163.208.2; posting-account=HFCrOQoAAABZD_f-UUbYHm3lJDIrh-UX
NNTP-Posting-Host: 136.163.208.2
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me> <4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>
Subject: Re: C time_t 2038 problem s-os_lib.ads
From: joaki...@kth.se (Joakim Strandberg)
Injection-Date: Thu, 23 Sep 2021 15:08:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 28
 by: Joakim Strandberg - Thu, 23 Sep 2021 15:08 UTC

torsdag 23 september 2021 kl. 17:01:04 UTC+2 skrev m8il...@gmail.com:
> On Thursday, September 23, 2021 at 2:26:11 PM UTC, Jeffrey R. Carter wrote:
> > On 9/23/21 12:42 PM, Kevin Chadwick wrote:
> > > I have noticed that C time_t appears to be Long_integer in Gnat s-os_lib.ads.
> > >
> > > Just wondering if it should be 64bit long long as OpenBSD has already moved to long long?
> > GNAT defines
> >
> > type Long_Integer is range -(2 **63) .. +(2 **63 - 1);
> > for Long_Integer'Size use 64;
> >
> I see, thank you.
>
> GPS doesn't seem to jump to declaration for Long_Integer and grep hasn't turned it up,
> so I will just take your word for it.

Well, yes Long_Integer is 64-bits, but long long in cpp is 128 bits which sounds like a discrepancy to me. On OpenBSD it indicates C time_t should be changed from Long_Integer to somethinge else that is 128-bits. All packages in Ada has "with Standard; use Standard;" which brings Integer etc. into scope. Long_Integer should be defined in the Standard package. Under help in GPS it should be possible to find the Standard package.

Best regards,
Joakim

Re: C time_t 2038 problem s-os_lib.ads

<0f98243e-b20a-4dd1-9061-457b607ea8c7n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6001&group=comp.lang.ada#6001

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:4e30:: with SMTP id d16mr5442517qtw.309.1632411560186;
Thu, 23 Sep 2021 08:39:20 -0700 (PDT)
X-Received: by 2002:a25:8409:: with SMTP id u9mr6219444ybk.159.1632411560056;
Thu, 23 Sep 2021 08:39:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 23 Sep 2021 08:39:19 -0700 (PDT)
In-Reply-To: <cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=84.92.86.82; posting-account=OCGnxwkAAADCyu751mus9xKbEvUSs9BP
NNTP-Posting-Host: 84.92.86.82
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me> <4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0f98243e-b20a-4dd1-9061-457b607ea8c7n@googlegroups.com>
Subject: Re: C time_t 2038 problem s-os_lib.ads
From: m8il1i...@gmail.com (Kevin Chadwick)
Injection-Date: Thu, 23 Sep 2021 15:39:20 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 11
 by: Kevin Chadwick - Thu, 23 Sep 2021 15:39 UTC

> Well, yes Long_Integer is 64-bits, but long long in cpp is 128 bits which sounds like a discrepancy to me. On OpenBSD it indicates C time_t should be changed from Long_Integer to somethinge else that is 128-bits.

I'm not sure OpenBSD uses c++ but their long long is 64 bits; seconds since Jan 1970. I guess this demonstrates an Ada strength.

> All packages in Ada has "with Standard; use Standard;" which brings Integer etc. into scope. Long_Integer should be defined in the Standard package. Under help in GPS it should be possible to find the Standard package.

Thank You. I have found it.

I expected it to jump to declaration if I included Long_Integer in a compiling program text but
it doesn't seem to work for types. Oh well.

Regards, Kc

Re: C time_t 2038 problem s-os_lib.ads

<8403e1b9-adf1-4b3c-9bc3-f9d24fac93e5n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6002&group=comp.lang.ada#6002

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:53d:: with SMTP id h29mr5483937qkh.395.1632412634502;
Thu, 23 Sep 2021 08:57:14 -0700 (PDT)
X-Received: by 2002:a05:6902:566:: with SMTP id a6mr6430090ybt.163.1632412634365;
Thu, 23 Sep 2021 08:57:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 23 Sep 2021 08:57:14 -0700 (PDT)
In-Reply-To: <0f98243e-b20a-4dd1-9061-457b607ea8c7n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=84.92.86.82; posting-account=OCGnxwkAAADCyu751mus9xKbEvUSs9BP
NNTP-Posting-Host: 84.92.86.82
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me> <4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com> <0f98243e-b20a-4dd1-9061-457b607ea8c7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8403e1b9-adf1-4b3c-9bc3-f9d24fac93e5n@googlegroups.com>
Subject: Re: C time_t 2038 problem s-os_lib.ads
From: m8il1i...@gmail.com (Kevin Chadwick)
Injection-Date: Thu, 23 Sep 2021 15:57:14 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 5
 by: Kevin Chadwick - Thu, 23 Sep 2021 15:57 UTC

> > All packages in Ada has "with Standard; use Standard;" which brings Integer etc. into scope. Long_Integer should be defined in the Standard package. Under help in GPS it should be possible to find the Standard package.
> Thank You. I have found it.

Strange, The package Standard file shows Long_Integer as range 64bit.
VsCode during hover on Long_Integer shows 32 bit, as it's range.

Re: C time_t 2038 problem s-os_lib.ads

<874kabm5mp.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6005&group=comp.lang.ada#6005

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: C time_t 2038 problem s-os_lib.ads
Date: Thu, 23 Sep 2021 12:52:30 -0700
Organization: None to speak of
Lines: 56
Message-ID: <874kabm5mp.fsf@nosuchdomain.example.com>
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me>
<4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="8bcb0bda835272ce79dfeccf3aad56df";
logging-data="14941"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1986MSHHr9MtCQhl1Iz0cDB"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:5agJg+/V+fAFlDoMz7Yv5oupmOo=
sha1:pW4yYXhQGSRXHQePxQoILdtFAHY=
 by: Keith Thompson - Thu, 23 Sep 2021 19:52 UTC

Joakim Strandberg <joakimds@kth.se> writes:
> torsdag 23 september 2021 kl. 17:01:04 UTC+2 skrev m8il...@gmail.com:
>> On Thursday, September 23, 2021 at 2:26:11 PM UTC, Jeffrey R. Carter wrote:
>> > On 9/23/21 12:42 PM, Kevin Chadwick wrote:
>> > > I have noticed that C time_t appears to be Long_integer in Gnat s-os_lib.ads.
>> > >
>> > > Just wondering if it should be 64bit long long as OpenBSD has already moved to long long?
>> > GNAT defines
>> >
>> > type Long_Integer is range -(2 **63) .. +(2 **63 - 1);
>> > for Long_Integer'Size use 64;

Does it do that on all operating systems? C's type long is 32 bits on
64-bit Windows. (Of course Ada's Long_Integer doesn't have to match C's
long.)

>> I see, thank you.
>>
>> GPS doesn't seem to jump to declaration for Long_Integer and grep hasn't turned it up,
>> so I will just take your word for it.
>
> Well, yes Long_Integer is 64-bits, but long long in cpp is 128 bits
> which sounds like a discrepancy to me. On OpenBSD it indicates C
> time_t should be changed from Long_Integer to somethinge else that is
> 128-bits. All packages in Ada has "with Standard; use Standard;"
> which brings Integer etc. into scope. Long_Integer should be defined
> in the Standard package. Under help in GPS it should be possible to
> find the Standard package.

If by "cpp" you mean C++, I've never seen an implementation where long
long is 128 bits (or anything other than exactly 64 bits).

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.

If an Ada implementation makes Integer, Long_Integer, and
Long_Long_Integer correspond to C and C++'s int, long, and long long,
then on a system (e.g.,. Windows) where long is 32 bits, defining time_t
as Long_Integer is going to cause problems in 2038 -- *and* it's likely
not going to match the system's C and C++ time_t definition.

I don't see a definition of "time_t" in s-os_lib.ads on my system.

If an Ada implementation is going to define a type that's intended to
match C's time_t, it should match the representation of that C type.
I presume GNAT gets this right.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: C time_t 2038 problem s-os_lib.ads

<3c0272f8-4117-46a4-9051-5419d1edfdc6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6008&group=comp.lang.ada#6008

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:9e4b:: with SMTP id h72mr9255069qke.475.1632475975195;
Fri, 24 Sep 2021 02:32:55 -0700 (PDT)
X-Received: by 2002:a25:3086:: with SMTP id w128mr12038556ybw.139.1632475975030;
Fri, 24 Sep 2021 02:32:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 24 Sep 2021 02:32:54 -0700 (PDT)
In-Reply-To: <874kabm5mp.fsf@nosuchdomain.example.com>
Injection-Info: google-groups.googlegroups.com; posting-host=136.163.208.2; posting-account=HFCrOQoAAABZD_f-UUbYHm3lJDIrh-UX
NNTP-Posting-Host: 136.163.208.2
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me> <4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com> <874kabm5mp.fsf@nosuchdomain.example.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3c0272f8-4117-46a4-9051-5419d1edfdc6n@googlegroups.com>
Subject: Re: C time_t 2038 problem s-os_lib.ads
From: joaki...@kth.se (Joakim Strandberg)
Injection-Date: Fri, 24 Sep 2021 09:32:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 20
 by: Joakim Strandberg - Fri, 24 Sep 2021 09:32 UTC

> 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). I believe they are part of the new Ada2022 standard.

Best regards,
Joakim

Re: C time_t 2038 problem s-os_lib.ads

<ir5l07F5kirU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6009&group=comp.lang.ada#6009

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (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
Lines: 43
Message-ID: <ir5l07F5kirU1@mid.individual.net>
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me>
<4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@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
 by: Niklas Holsti - Fri, 24 Sep 2021 09:44 UTC

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.

Re: C time_t 2038 problem s-os_lib.ads

<87ilyplh4d.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6011&group=comp.lang.ada#6011

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: C time_t 2038 problem s-os_lib.ads
Date: Fri, 24 Sep 2021 15:54:10 -0700
Organization: None to speak of
Lines: 60
Message-ID: <87ilyplh4d.fsf@nosuchdomain.example.com>
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me>
<4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>
<874kabm5mp.fsf@nosuchdomain.example.com>
<3c0272f8-4117-46a4-9051-5419d1edfdc6n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="eb687d1a85d0437d520958888fe2a804";
logging-data="662"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/39c113qbP7W6Nn4jw2bzd"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:fvKuInDqPPLHxFMp3VsAO03qf/U=
sha1:PYM2KyTuVjdlkLH8w1aNC88T/gs=
 by: Keith Thompson - Fri, 24 Sep 2021 22:54 UTC

Joakim Strandberg <joakimds@kth.se> writes:
>> 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). I believe they are part of the new Ada2022
> standard.

That web page is simply wrong about long long being 128 bits. It
certainly can be (the C standard only says that it's at least 64 bits),
but it's exactly 64 bit on every implementation I've seen or heard of.

I'm not shocked that something on tutorialspoint.com is wrong.

There are several common data models in the C and C++ world:

Name ILP32 LP64 IL32P64
==== ===== ==== =======
char 8 8 8
short 16 16 16
int 32 32 32
long 32 64 32
long long 64 64 64
pointer 32 64 64

32-bit systems (which are becoming rarer for non-embedded systems)
typically use ILP32, and 64-bit Linux/Unix systems typically use LP64.
64-bit Windows uses IL32P64 (and hardly anything else does).

It's *seems* almost obvious that Ada's types
Character
Short_Integer
Integer
Long_Integer
Long_Long_Integer
should correspond to the similarly named C types, but it's not required.
(I don't know whether GNAT does so consistently or not.)

Some C and C++ compilers support 128-bit integers on 64-bit systems.
gcc supports "__int128" and "unsigned __int128", but they don't quite
meet all the C requirements for integer types; for example, there are no
literals of those types.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: C time_t 2038 problem s-os_lib.ads

<simt8p$663$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6012&group=comp.lang.ada#6012

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: C time_t 2038 problem s-os_lib.ads
Date: Sat, 25 Sep 2021 12:22:17 +0200
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <simt8p$663$1@dont-email.me>
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me>
<4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>
<874kabm5mp.fsf@nosuchdomain.example.com>
<3c0272f8-4117-46a4-9051-5419d1edfdc6n@googlegroups.com>
<87ilyplh4d.fsf@nosuchdomain.example.com>
Reply-To: nonlegitur@notmyhomepage.de
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Sep 2021 10:22:17 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="de78c1bd0602bf85825835bb5cb12909";
logging-data="6339"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QcOqOVgNfH4R1+ewwHO6Fi6Ip6tSFEhs="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
Gecko/20100101 Thunderbird/78.14.0
Cancel-Lock: sha1:EtkS6vjOAKCuLtMhsNgj6yA3MWA=
In-Reply-To: <87ilyplh4d.fsf@nosuchdomain.example.com>
Content-Language: en-US
 by: G.B. - Sat, 25 Sep 2021 10:22 UTC

On 25.09.21 00:54, Keith Thompson wrote:

>
> It's *seems* almost obvious that Ada's types
> Character
> Short_Integer
> Integer
> Long_Integer
> Long_Long_Integer
> should correspond to the similarly named C types, but it's not required.
> (I don't know whether GNAT does so consistently or not.)
It might turn out as an advantage if Ada programs don't to use
types named like that.

First, the standard says an implementation MAY provide them.

Second, if Ada programs call C functions that take C int arguments,
then argument types taken from Interfaces.C seem to be the obvious
choice.

Just state what's needed in the type's definition in your program,
referring to "externally defined" types as required.

Re: C time_t 2038 problem s-os_lib.ads

<ly4ka8x5iu.fsf@pushface.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6013&group=comp.lang.ada#6013

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!RKN7TKnHC01q0gdg6EhkbQ.user.46.165.242.75.POSTED!not-for-mail
From: sim...@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: C time_t 2038 problem s-os_lib.ads
Date: Sat, 25 Sep 2021 12:23:53 +0100
Organization: Aioe.org NNTP Server
Message-ID: <ly4ka8x5iu.fsf@pushface.org>
References: <8936f386-3fdb-43b3-b912-317906d59631n@googlegroups.com>
<sii2q2$fcn$1@dont-email.me>
<4431fad9-d297-4d68-8c0f-fa771c6710f6n@googlegroups.com>
<cd4a94de-e8b9-4194-8d80-24a009a558ban@googlegroups.com>
<874kabm5mp.fsf@nosuchdomain.example.com>
<3c0272f8-4117-46a4-9051-5419d1edfdc6n@googlegroups.com>
<87ilyplh4d.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="433"; posting-host="RKN7TKnHC01q0gdg6EhkbQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:8PuOoNn9dbfBrjm9HQoBQ1HItak=
 by: Simon Wright - Sat, 25 Sep 2021 11:23 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> There are several common data models in the C and C++ world:
>
> Name ILP32 LP64 IL32P64
> ==== ===== ==== =======
> char 8 8 8
> short 16 16 16
> int 32 32 32
> long 32 64 32
> long long 64 64 64
> pointer 32 64 64
>
> 32-bit systems (which are becoming rarer for non-embedded systems)
> typically use ILP32, and 64-bit Linux/Unix systems typically use LP64.
> 64-bit Windows uses IL32P64 (and hardly anything else does).
>
> It's *seems* almost obvious that Ada's types
> Character
> Short_Integer
> Integer
> Long_Integer
> Long_Long_Integer
> should correspond to the similarly named C types, but it's not required.
> (I don't know whether GNAT does so consistently or not.)

Package Standard in FSF GCC 11.2.0 on macOS (which you can see by
compiling something with -gnatS) has

type Integer is range -(2 **31) .. +(2 **31 - 1);
for Integer'Size use 32;

subtype Natural is Integer range 0 .. Integer'Last;
subtype Positive is Integer range 1 .. Integer'Last;

type Short_Short_Integer is range -(2 **7) .. +(2 **7 - 1);
for Short_Short_Integer'Size use 8;

type Short_Integer is range -(2 **15) .. +(2 **15 - 1);
for Short_Integer'Size use 16;

type Long_Integer is range -(2 **63) .. +(2 **63 - 1);
for Long_Integer'Size use 64;

type Long_Long_Integer is range -(2 **63) .. +(2 **63 - 1);
for Long_Long_Integer'Size use 64;

type Long_Long_Long_Integer is range -(2 **127) .. +(2 **127 - 1);
for Long_Long_Long_Integer'Size use 128;

I didn't know about the last, which is new in FSF GCC 11/GNAT CE 2021
.... I could build my Analytical Engine simulator with 40 digit wheels
(i.e. capable of 40 decimal digits) instead of 50 using
Long_Long_Long_Integer instead of GNATColl.GMP.Integer.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor