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.74.201 with SMTP id w9mr9754392pbv.0.1328638972970; Tue, 07 Feb 2012 10:22:52 -0800 (PST) Path: lh20ni271343pbb.0!nntp.google.com!news2.google.com!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsfeed.freenet.ag!newsfeed.kamp.net!newsfeed.kamp.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Help needed - Upper Bound of an array - Question. Date: Tue, 07 Feb 2012 19:22:52 +0100 Organization: A noiseless patient Spider Message-ID: <87bopa33lv.fsf@ludovic-brenta.org> References: <9203a648-af0d-45a1-87ba-67373435b391@k10g2000yqk.googlegroups.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="INISNpsfsH3pck6m3bYcgw"; logging-data="25663"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n1T2+CWbA1vJ/UFiJ08hB" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:PM4ezTGTI8QqWCdXQzkzNimk4GI= sha1:+kU5Y75oyaZ5Ae5muLXX559nMCc= Content-Type: text/plain; charset=us-ascii Date: 2012-02-07T19:22:52+01:00 List-Id: 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. > > SUBTYPE Index_30 IS Integer RANGE -500000 .. 500000; > TYPE I_CoefficientsNumArray IS ARRAY(Index_30) OF Integer; > I_Num : I_CoefficientsNumArray; > -- 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 := 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. In fact, even I enjoyed this book thoroughly when I learned Ada as my 12th (or so) programming language :) -- Ludovic Brenta.