comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Pointer to Array
Date: Tue, 16 Oct 2007 10:16:30 -0400
Date: 2007-10-16T10:16:30-04:00	[thread overview]
Message-ID: <wcctzorywjl.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1192542030.745091.64900@q5g2000prf.googlegroups.com

shaunpatterson@gmail.com writes:

> -- system 1
>     type INT_ARRAY is new Integer (1..SYSTEM_1_SIZE);
>
>     Int_Array_Var : INT_ARRAY;

The above doesn't seem right -- not sure what you really meant.

>     if usingSystem1 then
>         Int_array_Var = "pointer to Int_Array_Var_System1"

You can do something like:

    type Int_Array_Ref is access all INT_ARRAY;
    Int_Array_Var : Int_Array_Ref;
    ...
    if .,. then
        Int_Array_Var := Int_Array_Var_System1'Access;
        -- Make Int_Array_Var point to Int_Array_Var_System1.
    ...

You need to make the variables "aliased" -- otherwise,
'Access is illegal.  You might need to add ".all" in
a few places, but in most contexts (including A'Range,
and A(I)), the ".all" is implicit.

But it might be cleaner to pass the arrays around as parameters.

- Bob



      parent reply	other threads:[~2007-10-16 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-16 13:40 Pointer to Array shaunpatterson
2007-10-16 14:09 ` Niklas Holsti
2007-10-16 14:16 ` Robert A Duff [this message]
replies disabled

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