comp.lang.ada
 help / color / mirror / Atom feed
From: adacrypt <austin.obyrne@hotmail.com>
Subject: Re: Help needed - Upper Bound of an array - Question.
Date: Tue, 7 Feb 2012 12:42:35 -0800 (PST)
Date: 2012-02-07T12:42:35-08:00	[thread overview]
Message-ID: <7b2a0029-5f3e-4e63-aff5-a63e22d80eeb@l1g2000vbc.googlegroups.com> (raw)
In-Reply-To: 87bopa33lv.fsf@ludovic-brenta.org

On Feb 7, 6:22 pm, Ludovic Brenta <ludo...@ludovic-brenta.org> 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.
>
> >  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.

Many Many thanks to every one - adacrypt



  reply	other threads:[~2012-02-07 20:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 14:41 Help needed - Upper Bound of an array - Question adacrypt
2012-02-07 15:00 ` Yannick Duchêne (Hibou57)
2012-02-07 15:04 ` Mark Lorenzen
2012-02-07 15:08 ` Ludovic Brenta
2012-02-07 15:27   ` Yannick Duchêne (Hibou57)
2012-02-07 15:59   ` adacrypt
2012-02-07 16:13     ` Gautier write-only
2012-02-07 17:30     ` Jeffrey Carter
2012-02-07 19:51       ` tmoran
2012-02-09  3:31         ` Randy Brukardt
2012-02-07 18:22     ` Ludovic Brenta
2012-02-07 20:42       ` adacrypt [this message]
2012-02-07 18:56     ` Georg Bauhaus
2012-02-07 21:22     ` Robert A Duff
2012-02-07 15:33 ` Álex R. Mosteo
2012-02-07 22:08 ` Jerry
replies disabled

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