comp.lang.ada
 help / color / mirror / Atom feed
* Implementation of arrays in Ada compilers.
@ 2021-02-23 18:10 Vincent DIEMUNSCH
  2021-02-24 18:02 ` AdaMagica
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent DIEMUNSCH @ 2021-02-23 18:10 UTC (permalink / raw)


Hello,

I would like to know what is the runtime implementation of arrays used by compilers, and GNAT in particular.

Does an array is represented as an address, a starting index (First) and an ending index (Last) ? Or a First index and a Length.
Is the address the A’First’Address ?
And what about slicing ? Is the address modified ?
And what about passing arrays as reference ?
And what happens when the array is a component of a record :
type OneString (Length : Integer) is
   record
        Data : String(1 .. Length);
   end record;

Is this optimized as a special kind of arrays ?

Is there a paper that discusses these implementation choices ?


Regards,

Vincent

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Implementation of arrays in Ada compilers.
  2021-02-23 18:10 Implementation of arrays in Ada compilers Vincent DIEMUNSCH
@ 2021-02-24 18:02 ` AdaMagica
  0 siblings, 0 replies; 2+ messages in thread
From: AdaMagica @ 2021-02-24 18:02 UTC (permalink / raw)


Vincent DIEMUNSCH schrieb am Dienstag, 23. Februar 2021 um 19:10:11 UTC+1:

The RM is silent on most of these questions. This is the only specific statement:
> Is the address the A’First’Address ?
For an array A,
A'Address = A(A'First)'Address

For the rest, see M.3 Implementation Advice.

Ada has not much to say about the choice of implementation. Compiler builders will diligently choose,  and it's the RM's role to pose as little as possible restrictions.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-24 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 18:10 Implementation of arrays in Ada compilers Vincent DIEMUNSCH
2021-02-24 18:02 ` AdaMagica

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