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, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5d624451bcaff335 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!l35g2000pra.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Null Range in Unconstrasined Array Date: Tue, 8 Sep 2009 10:54:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: <68f49a20-2142-46ee-bed8-e5b3cad398e0@l35g2000pra.googlegroups.com> References: <76a9c14b-c573-4fd4-bbd8-7ab3bd078d79@j9g2000prh.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1252432448 20646 127.0.0.1 (8 Sep 2009 17:54:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 Sep 2009 17:54:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l35g2000pra.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8236 Date: 2009-09-08T10:54:08-07:00 List-Id: On Sep 6, 5:41=A0am, Robert A Duff wrote: > There are several ways to implement that. > For example, the procedure could be passed the bounds as separate > parameters, in two registers. =A0I don't consider that to > be "memory allocated for My_Array", because it is not > allocated when the compiler sees My_Array -- it is allocated > when the compiler sees a call (and separately for each call). > In this case, My_Array'Address =3D X'Address is likely. To elaborate on this a bit further: Suppose you define a record type for reading a file with Ada.Direct_IO, that looks something like this: type Employee_Data is record Name : String (1 .. 50); Address1 : String (1 .. 40); Address2 : String (1 .. 40); City : String (1 .. 30); State : String (1 .. 2); ... end record; (Reminds me of my COBOL programming days...) Anyway, it would be very unexpected for the compiler to put two extra integers in the record for each of these strings, and it would mess up your file I/O. But you have to have the ability to pass any of those fields to a subprogram with a parameter type "String", and the bounds have to be passed to the subprogram somehow. I think it's most likely that the bounds will be passed separately, as Bob suggested, either by passing them in separate registers, creating a three-word temporary structure that contains the bounds and a pointer to the data and passing the address of that structure (with that structure disappearing after the subprogram returns), creating a two-word structure with the bounds and passing the address of that in a register, etc. Something along those lines. But I'd actually be surprised if *any* implementation allocated extra space in an Employee_Data record to hold the bounds of each field. -- Adam