comp.lang.ada
 help / color / mirror / Atom feed
From: "Davide" <ppp@ppp.it>
Subject: Re: allocation of an array
Date: Mon, 1 Mar 2004 18:49:47 +0100
Date: 2004-03-01T18:49:47+01:00	[thread overview]
Message-ID: <c1vt3t$np4$1@e3k.asi.ansaldo.it> (raw)
In-Reply-To: WuidnZl5yqvGwN7dRVn-ig@comcast.com


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







  reply	other threads:[~2004-03-01 17:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-01 14:02 allocation of an array Davide
2004-03-01 15:57 ` Robert I. Eachus
2004-03-01 17:49   ` Davide [this message]
2004-03-02  2:49     ` Robert I. Eachus
2004-03-15 10:37     ` Rod Chapman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox