From: Jerry <lanceboyle@qwest.net>
Subject: Re: segfault with large-ish array with GNAT
Date: Fri, 19 Mar 2010 16:24:41 -0700 (PDT)
Date: 2010-03-19T16:24:41-07:00 [thread overview]
Message-ID: <58da0e59-418b-4545-a29c-9403d1ab6288@b9g2000pri.googlegroups.com> (raw)
In-Reply-To: ho0mqe$efe$1@tornado.tornevall.net
On Mar 19, 1:22 pm, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> wrote:
> Brian Drummond wrote:
>
> > But code using the array can be written as normal, with a "my_array ... renames
> > my_array_ptr.all" clause to hide the pointer.
>
> Generally, after something like
>
> A : constant Array_Ptr := new Array_Type [(Low .. High)];
>
> You can use A just as if it were the array itself:
>
> B := A (A'First);
> A (A'First) := A (A'Last);
> A (A'Last) := B;
>
> --
> Jeff Carter
That is true when accessing array elements and slices but not for
indicating the entire array as a single entity such as in a subroutine
argument, e.g.
y := cos(x);
or
z := x + y;
with
function "+" (Left, Right : Real_Vector) return Real_Vector;
which is from ARM G.3.1.
Using access variables without renaming, the above line would have to
be written
y := cos(x.all);
and
z.all := x.all + y.all;
and in the algebraic-like calculations that are possible using
overloads the .all's clutter up the equation a bit. It's just a matter
of where you want to put the eye pollution. I have an extensive
library of subroutines including overloads that work with Real_Vector
and Complex_Vector from G.3 and either way (renaming or .all-ing)
works fine but on balance I think renaming is easier to read (and
probably easier to forget to release memory 8^( .)
Jerry
next prev parent reply other threads:[~2010-03-19 23:24 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 19:21 segfault with large-ish array with GNAT Jerry
2010-03-17 19:36 ` Gautier write-only
2010-03-17 19:58 ` Georg Bauhaus
2010-03-18 6:45 ` Jerry
2010-03-18 7:52 ` Ludovic Brenta
2010-03-18 23:57 ` Robert A Duff
2010-03-18 10:13 ` Jeffrey Creem
2010-03-18 10:23 ` Ludovic Brenta
2010-03-19 0:44 ` Jerry
2010-03-18 19:51 ` Adam Beneschan
2010-03-18 14:44 ` John B. Matthews
2010-03-19 4:44 ` Jeffrey R. Carter
2010-03-19 8:14 ` John B. Matthews
2010-03-18 15:36 ` Gautier write-only
2010-03-18 16:46 ` tmoran
2010-03-18 19:11 ` Warren
2010-03-18 17:03 ` Warren
2010-03-18 20:38 ` Maciej Sobczak
2010-03-19 13:26 ` Charmed Snark
2010-03-19 17:27 ` tmoran
2010-03-19 18:02 ` Simon Wright
2010-03-19 20:10 ` Warren
2010-03-19 21:50 ` Adam Beneschan
2010-03-19 20:24 ` Warren
2010-03-19 20:38 ` Warren
2010-03-19 8:31 ` Ludovic Brenta
2010-03-19 13:20 ` Warren
2010-03-19 12:04 ` Brian Drummond
2010-03-19 19:22 ` Jerry
2010-03-19 20:22 ` Jeffrey R. Carter
2010-03-19 23:24 ` Jerry [this message]
2010-03-20 0:25 ` Jeffrey R. Carter
2010-05-07 21:58 ` Raising the stack limit (was: segfault with large-ish array with GNAT) Björn Persson
2010-03-17 19:57 ` segfault with large-ish array with GNAT jonathan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox