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,ae395e5c11de7bc9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!b9g2000pri.googlegroups.com!not-for-mail From: Jerry Newsgroups: comp.lang.ada Subject: Re: segfault with large-ish array with GNAT Date: Fri, 19 Mar 2010 16:24:41 -0700 (PDT) Organization: http://groups.google.com Message-ID: <58da0e59-418b-4545-a29c-9403d1ab6288@b9g2000pri.googlegroups.com> References: <642ddf8b-1d45-4f74-83ad-2c755040ca33@k24g2000pro.googlegroups.com> <4ba13454$0$6720$9b4e6d93@newsspool2.arcor-online.net> <12q6q5hjqihq8lpgpt9mjmn30l9q9lrmkm@4ax.com> NNTP-Posting-Host: 75.172.190.146 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1269041081 7403 127.0.0.1 (19 Mar 2010 23:24:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 19 Mar 2010 23:24:41 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b9g2000pri.googlegroups.com; posting-host=75.172.190.146; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/528.16+(KHTML, like Gecko, Safari/528.16) OmniWeb/v622.8.0,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:10648 Date: 2010-03-19T16:24:41-07:00 List-Id: On Mar 19, 1:22=A0pm, "Jeffrey R. Carter" 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 :=3D new Array_Type [(Low .. High)]; > > You can use A just as if it were the array itself: > > B :=3D A (A'First); > A (A'First) :=3D A (A'Last); > A (A'Last) :=3D 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 :=3D cos(x); or z :=3D 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 :=3D cos(x.all); and z.all :=3D 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