From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d679dd7e9c16805a X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad.newshosting.com!newshosting.com!newspeer.monmouth.com!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Selective suppression of warnings --- gnat on GNU/Linux Date: Wed, 31 Dec 2008 17:38:35 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <7a6baa71-80e8-4f3a-80b6-34935bda2fc0@r10g2000prf.googlegroups.com> <42ffjg.s9b.ln@hunter.axlog.fr> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1230763115 18115 192.74.137.71 (31 Dec 2008 22:38:35 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 31 Dec 2008 22:38:35 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:2BUlN1Rd+JRq6yYrmkv4uKEQWrE= Xref: g2news2.google.com comp.lang.ada:4132 Date: 2008-12-31T17:38:35-05:00 List-Id: "Jeffrey R. Carter" 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