From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: different compilers: different standard types?????
Date: 18 Mar 2004 20:08:59 -0500
Date: 2004-03-18T20:08:59-05:00 [thread overview]
Message-ID: <mailman.111.1079658554.327.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <200403181313.16003.maa@liacc.up.pt>
Marius Amado Alves <maa@liacc.up.pt> writes:
> The standard requires that "the range of Integer should be no wider
> than that of Long_Integer" 3.5.4 (25). (I'm not sure this is an
> intelligent limitation, but never mind.)
What would you like it to say instead?
> GNAT defines Integer and Long_Integer for 32-bit, and
> Long_Long_Integer for 64-bit.
>
> So if you want to define an integral type with a greater range than
> (the associated with) 32 bits, you have to use Long_Long_Integer as
> a base.
Hmm. Let's declare a type:
type My_Long_Int is range -2**50 .. 2**50 -1;
You don't _specify_ Long_Long_Integer, but the compiler does use a 64
bit integer as the base type. Just to be picky :).
> But then you hinder portability, because Long_Long_Integer is not
> standard.
The problem is not that Long_Long_Integer is not standard; the problem
is that 64 bits is not standard. Neither, for that matter, is 32 bits;
the standard only requires 16 bit integers.
> So I guess my question is: Why does not GNAT define Integer (and
> Long_Integer) for 64-bits?
How would that improve portability? As long as other compilers don't
support 64 bit integers, using them will be none-portable.
Integer is used for the index of String; it probably does not make
sense for that to be 64 bits. Why waste space?
It might make sense for Long_Integer to be 64 bits.
But none of this really matters; you should _never_ use an integer
type declared in Standard (except Integer for String indices, or when
you really don't care about size).
> AFAICS the standard does not impose a upper limit on Integer.
True.
> And don't tell me the answer is: Because then Short_Integer would
> have 32-bits, and that is not what the C world calls short.
That is certainly not the answer; C types are in Interfaces.C, not
Standard.
--
-- Stephe
next prev parent reply other threads:[~2004-03-19 1:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-17 8:15 different compilers: different standard types????? Riccardo
2004-03-17 17:10 ` Martin Krischik
2004-03-18 3:47 ` Steve
2004-03-18 10:37 ` Jean-Pierre Rosen
2004-03-18 13:09 ` Dmitry A. Kazakov
2004-03-18 13:13 ` Marius Amado Alves
2004-03-18 14:21 ` Ludovic Brenta
2004-03-18 14:45 ` Georg Bauhaus
2004-03-18 17:33 ` Marius Amado Alves
2004-03-18 17:42 ` Martin Krischik
2004-03-19 0:16 ` Jeffrey Carter
[not found] ` <200403181313.16003.maa@liacc.up.pt>
2004-03-18 19:35 ` Duncan Sands
2004-03-19 1:08 ` Stephen Leake [this message]
[not found] ` <200403182035.57424.baldrick@free.fr>
2004-03-19 8:07 ` Marius Amado Alves
2004-03-19 3:29 ` Steve
2004-03-19 15:36 ` Marius Amado Alves
[not found] ` <00a401c40dc7$f2b333e0$c32416d5@netcabo.pt>
2004-03-19 16:03 ` Marius Amado Alves
[not found] ` <u7jxhprro.fsf@acm.org>
[not found] ` <005f01c40dbf$94ce9e20$c32416d5@netcabo.pt>
2004-03-19 13:19 ` Stephen Leake
2004-03-19 14:36 ` Marius Amado Alves
2004-03-19 10:16 ` Jean-Pierre Rosen
2004-03-20 0:52 ` Jeffrey Carter
2004-03-20 22:56 ` Marius Amado Alves
-- strict thread matches above, loose matches on Subject: below --
2004-03-19 7:33 Riccardo
2004-03-19 13:10 ` Martin Dowie
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox