Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ada > #49619

Re: C time_t 2038 problem s-os_lib.ads

From Simon Wright <simon@pushface.org>
Newsgroups comp.lang.ada
Subject Re: C time_t 2038 problem s-os_lib.ads
Date 2021-09-25 12:23 +0100
Organization Aioe.org NNTP Server
Message-ID <ly4ka8x5iu.fsf@pushface.org> (permalink)
References (2 earlier) <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>

Show all headers | View raw


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.

Back to comp.lang.ada | Previous | NextPrevious in thread | Find similar


Thread

C time_t 2038 problem s-os_lib.ads Kevin Chadwick <m8il1ists@gmail.com> - 2021-09-23 03:42 -0700
  Re: C time_t 2038 problem s-os_lib.ads "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> - 2021-09-23 16:26 +0200
    Re: C time_t 2038 problem s-os_lib.ads Kevin Chadwick <m8il1ists@gmail.com> - 2021-09-23 08:01 -0700
      Re: C time_t 2038 problem s-os_lib.ads Joakim Strandberg <joakimds@kth.se> - 2021-09-23 08:08 -0700
        Re: C time_t 2038 problem s-os_lib.ads Kevin Chadwick <m8il1ists@gmail.com> - 2021-09-23 08:39 -0700
          Re: C time_t 2038 problem s-os_lib.ads Kevin Chadwick <m8il1ists@gmail.com> - 2021-09-23 08:57 -0700
        Re: C time_t 2038 problem s-os_lib.ads Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-23 12:52 -0700
          Re: C time_t 2038 problem s-os_lib.ads Joakim Strandberg <joakimds@kth.se> - 2021-09-24 02:32 -0700
            Re: C time_t 2038 problem s-os_lib.ads Niklas Holsti <niklas.holsti@tidorum.invalid> - 2021-09-24 12:44 +0300
            Re: C time_t 2038 problem s-os_lib.ads Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-24 15:54 -0700
              Re: C time_t 2038 problem s-os_lib.ads "G.B." <bauhaus@notmyhomepage.invalid> - 2021-09-25 12:22 +0200
              Re: C time_t 2038 problem s-os_lib.ads Simon Wright <simon@pushface.org> - 2021-09-25 12:23 +0100

csiph-web