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.0 required=5.0 tests=BAYES_00,FORGED_HOTMAIL_RCVD2, FREEMAIL_FROM autolearn=no 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 Received: by 10.68.226.10 with SMTP id ro10mr15056433pbc.6.1328647456815; Tue, 07 Feb 2012 12:44:16 -0800 (PST) Path: lh20ni271704pbb.0!nntp.google.com!news1.google.com!postnews.google.com!l1g2000vbc.googlegroups.com!not-for-mail From: adacrypt Newsgroups: comp.lang.ada Subject: Re: Help needed - Upper Bound of an array - Question. Date: Tue, 7 Feb 2012 12:42:35 -0800 (PST) Organization: http://groups.google.com Message-ID: <7b2a0029-5f3e-4e63-aff5-a63e22d80eeb@l1g2000vbc.googlegroups.com> References: <9203a648-af0d-45a1-87ba-67373435b391@k10g2000yqk.googlegroups.com> <87bopa33lv.fsf@ludovic-brenta.org> NNTP-Posting-Host: 31.52.183.40 Mime-Version: 1.0 X-Trace: posting.google.com 1328647456 30620 127.0.0.1 (7 Feb 2012 20:44:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 7 Feb 2012 20:44:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l1g2000vbc.googlegroups.com; posting-host=31.52.183.40; posting-account=pmkN8QoAAAAtIhXRUfydb0SCISnwaeyg User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB7.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-02-07T12:42:35-08:00 List-Id: On Feb 7, 6:22=A0pm, Ludovic Brenta wrote: > adacrypt writes on comp.lang.ada: > > > Many thanks to everyone - your'e a bit over my head technically but I > > get the gist of it from each one of you. > > > This is my declaration. > > > =A0SUBTYPE Index_30 IS Integer RANGE -500000 .. 500000; > > =A0 TYPE I_CoefficientsNumArray IS ARRAY(Index_30) OF Integer; > > =A0 I_Num : I_CoefficientsNumArray; > > =A0 -- counts the occurences of the j coefficients of the ciphertext. > > > Question : can I use your 'big array' declaration procedure in Ada-95 > > just as you have typed here ? that would be great - will it work just > > by replacing the present declaration with this? do I type in as a > > straight crib just like that, regards - adacrypt > > Yes, you would simply augment your program with an access type > declaration like so: > > SUBTYPE Index_30 IS Integer RANGE -500000 .. 500000; > TYPE I_CoefficientsNumArray IS ARRAY(Index_30) OF Integer; > > type Array_Access is access I_CoefficientsNumArray; -- new type > > I_Num : Array_Access :=3D new I_CoefficientsNumArray; -- allocate on the = heap > -- counts the occurences of the j coefficients of the ciphertext. > > For more details on dynamic memory allocation and deallocation and > access types, read this: > > http://www.it.bton.ac.uk/staff/je/adacraft/ch11.htm > > which is the book I recommend for novice programmers. =A0In fact, even I > enjoyed this book thoroughly when I learned Ada as my 12th (or so) > programming language :) > > -- > Ludovic Brenta. Many Many thanks to every one - adacrypt