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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3467cec1612741de X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-20 06:40:37 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!titan03.ksc.nasa.gov!niven.ksc.nasa.gov!usenet From: "Samuel T. Harris" Newsgroups: comp.lang.ada Subject: Re: Anonymous array clarification. Date: Mon, 20 Aug 2001 08:37:16 -0500 Organization: Raytheon Aerospace Engineering Services Message-ID: <3B81128C.82CD1009@gsde.hou.us.ray.com> References: Reply-To: samuel_t_harris@raytheon.com NNTP-Posting-Host: sstf-fw.jsc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.7 [en] (X11; U; IRIX64 6.2 IP19) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:12120 Date: 2001-08-20T08:37:16-05:00 List-Id: McDoobie wrote: > > In Ada one can declare anonymous arrays (an array without a type assigned > to it.) However what would such an array be used for, and are the bounds > on it's use the same as for any other type of array. > > I guess what I'm asking is if I declare an array such as > > some_array : array(1..N); This is an illegal type definition and your expection that this is valid is, I believe, the root of your other questions. Correct to say ... some_array : array (1..n) of character; ... where even anonymous arrays must have the "of " element. > > Can I assign values such as '1' '2' '3' 'H' 'y' '-' 'foo' all to the same > array? And how would those values be stored in memory? As Hex data with > thier values revealed according to the context of the code block they're > in? How would I tell it to read the data stored in that block as Integers, > Chars, et...? Of course, as you can see above, questions about how the array components are interpreted are moot in that the anonymous array definition has a specific component type. As to storage and the other issues, just think of the above code as equivalent to ... type _anonymous_some_array_type_ is array (1..n) of character; some_array : anonyous_some_array_type; ... where the type of object some_array is internally generated, it just has no name explicitly represented in your source code. > > As a side note, I'll be downloading the source code to GNAT so that I can > get a better understanding as to how this all works. > > Any help would be appreciated. > > Thanks > > McDoobie > > chris@dont.spam.me -- Samuel T. Harris, Senior Software Engineer II Raytheon, Aerospace Engineering Services "If you can make it, We can fake it!"