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,1ff542cf207f32ca X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.73.229 with SMTP id o5mr259598pbv.7.1328758318303; Wed, 08 Feb 2012 19:31:58 -0800 (PST) MIME-Version: 1.0 Path: wr5ni3464pbc.0!nntp.google.com!news1.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Help needed - Upper Bound of an array - Question. Date: Wed, 8 Feb 2012 21:31:45 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1328758313 4105 69.95.181.76 (9 Feb 2012 03:31:53 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 9 Feb 2012 03:31:53 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-02-08T21:31:45-06:00 List-Id: To correct Tom slightly, this will work when allocated in a package, but probably not when allocated in a procedure (like the main subprogram). For the OP's declaration, allocation on the heap shouldn't be necessary, but library-level allocation is a must. (But I have never tried to allocate really big objects in GNAT.) Randy. wrote in message news:jgrvc5$243$1@speranza.aioe.org... >> > SUBTYPE Index_30 IS Integer RANGE -500000 .. 500000; >> > TYPE I_CoefficientsNumArray IS ARRAY(Index_30) OF Integer; >> > I_Num : I_CoefficientsNumArray; >> >> Here is a 3rd source of limits on the size of the array: the index >> subtype of >> the array, in this case Index_30. Index_30 has 1_000_001 values, so I_Num >> has >> 1_000_001 components. > > The OP is probably using Gnat, with its very limited stack size. Other > Ada compilers are not so limited. Janus, for instance, compiles, and > runs on an old 3GB 32 bit Windows XP machine: > > type Index_30 is range -100_000_000 .. 100_000_000; > type Coefficient_Type is new Interfaces.Unsigned_32; > TYPE I_CoefficientsNumArray IS ARRAY(Index_30) OF Coefficient_Type; > I_Num : I_CoefficientsNumArray; > > which allocates 800,000,004 bytes.