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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dfb1becd7014a395 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-01 10:40:37 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.wirehub.nl!surfnet.nl!teleglobe.net!151.99.250.105.MISMATCH!news.finmeccanica.it!not-for-mail From: "Davide" Newsgroups: comp.lang.ada Subject: Re: allocation of an array Date: Mon, 1 Mar 2004 18:49:47 +0100 Organization: Finmeccanica Message-ID: References: NNTP-Posting-Host: 192.168.54.114 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Xref: archiver1.google.com comp.lang.ada:5982 Date: 2004-03-01T18:49:47+01:00 List-Id: Robert I. Eachus wrote: > For an Ada beginner, you ask pretty subtle questions! There are three > answers to your question. The first is that yes, you can always count > on an Ada array being an array, where the data elements are evenly > spaced. Beyond that it gets tricky. [CUT] > I hope this answer is not overwhelming. In practice you can ignore all > of it unless you have to interface with hardware, or with code in some > other language. Thank you very much for your exhaustive response, Robert. I hope not to bother you if I try to explain a little bit better why my question arose. First of all I must use the SPARK Ada subset (so no access types, no unconstrained arrays,...quite nothing...). My machine is a Power-PC with 32-bit alignment. My compiler is AdaMulti. I must download long messages composed of 16-bit integers items from a FIFO memory device. In my implementation I store them into arrays of 16 bit-integers. Then I have to filter those buffered messages, extracting a subset of items. I chosen to use a constant array of offsets for each message (an offset index for each item to extract). Then I go through the array extracting items at the specified indexes. This is my solution, but now I'm wondering if I could have done better if I had "mapped" a record to each of those arrays, with 16-bit fields corresponding to the message items and copying the relevant items to "filtered" records. That's why I was asking about the array allocation, that is therefore essential to this solution. I still hope that the first solution could be preferable...since I have done a lot of code... :-) ...what do you think, also in terms of portability and reusability (i.e independence from platform and compiler, which I like to take into account)? Sorry for my bad english, and thank you for your patience, Dave