comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Selective suppression of warnings --- gnat on GNU/Linux
Date: Wed, 31 Dec 2008 17:38:35 -0500
Date: 2008-12-31T17:38:35-05:00	[thread overview]
Message-ID: <wcc3ag4ezro.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: oyQ6l.504823$yE1.127677@attbi_s21

"Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org> writes:

> Robert A Duff wrote:
>> More generally, it would also be nice to have a way to say, "Give me a
>> number that would be appropriate as the upper bound of an array whose
>> component type is T."  The number would be guaranteed to be big enough
>> that you would get Storage_Error if you ever create an array that big.
>
> Isn't that approximated by System.Max_Int and System.Max_Binary_Modulus?

Well, the RM doesn't say that, and it's not true on at least some
implementations.  For example, GNAT on a 32-bit machine has
System.Max_Int = 2**63-1.  But if I want a possibly large
array of Integers, I want something like:

    type Index is range 1..2**31-1;
    type A is array (Index range <>) of Integer;

Or I might want 2**32-1, but 2**63-1 is way too big for a 32-bit
machine, and would be unnecessarily inefficient.

> On many modern processors and OSes, though, one could possibly have a
> packed array of Boolean with those bounds that would fit in the
> available memory. But since you can't create an integer type with more
> values, the desired effect would be impossible to achieve.

Good point.

On a 64-bit machine, you have enough virtual memory to create a packed
array of 2**63-1 Booleans (2**60 bytes), but you don't have enough
physical memory, or even paging file, to store it.

- Bob



  reply	other threads:[~2008-12-31 22:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30  3:13 Selective suppression of warnings --- gnat on GNU/Linux Michael Mounteney
2008-12-30  8:03 ` Ludovic Brenta
2008-12-30 22:49   ` Michael Mounteney
2008-12-30 23:26     ` Robert A Duff
2008-12-30 11:01 ` (see below)
2008-12-30 11:37   ` Georg Bauhaus
2008-12-30 12:05     ` (see below)
2008-12-30 14:11       ` Pascal ranges (was: Selective suppression of warnings --- gnat on GNU/Linux) Georg Bauhaus
2008-12-30 20:19         ` (see below)
2008-12-30 23:19           ` Pascal ranges Robert A Duff
2008-12-30 23:34             ` (see below)
2008-12-31  0:07               ` Robert A Duff
2008-12-31  0:32                 ` (see below)
2008-12-30 23:13 ` Selective suppression of warnings --- gnat on GNU/Linux Robert A Duff
2008-12-31  9:46   ` Jean-Pierre Rosen
2008-12-31 14:55     ` Robert A Duff
2008-12-31 16:13       ` Jean-Pierre Rosen
2008-12-31 20:01         ` Robert A Duff
2008-12-31 18:43     ` (see below)
2008-12-31 19:49       ` Robert A Duff
2008-12-31 20:24         ` Jeffrey R. Carter
2008-12-31 22:38           ` Robert A Duff [this message]
2008-12-31 19:46 ` Jerry
2008-12-31 22:39   ` Robert A Duff
2008-12-31 23:37   ` Michael Mounteney
2009-01-01  9:45   ` sjw
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox