comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Passing Range Parameters to new instance of unbounded, boxed <> array in Ada
Date: Wed, 14 Jul 2021 08:18:52 +0200	[thread overview]
Message-ID: <sclvk9$shd$1@dont-email.me> (raw)
In-Reply-To: <41b30ab1-9114-4bfa-baeb-94c39a4be00an@googlegroups.com>

Le 14/07/2021 à 04:53, Mace Ayres a écrit :
> 1) I declare - Type a_gear is array(index range <>) of Intgeger;
> 
> 2) I want to create an instance of type a_gear
>       Gear : a_gear (var_strt..var_end);
> ————————————-
> Both 1 and 2 must be declared after …. an ‘Is’ and before a ‘BEGIN’ of any code block
> 
> but I can’t code a sub program to get a user’s input for var_strt and
> var_end until after a BEGIN statement which too late to pass to the
> parameterized unbounded/Box array gear.
> 
> I am not getting the proper visibility and scope to capture user’s
> parameters before I declare an instance, gear, of the type a_gear, an
> unbounded array?
> 
This is a classical case for a "declare" block:

procedure Your_Proc is
begin
    ... get Var_Strt and Var_End here ...

    declare
       Gear : a_gear (var_strt..var_end);
    begin
       ... use your variable here ...
    end;
end Your_Proc;

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

      reply	other threads:[~2021-07-14  6:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  2:53 Passing Range Parameters to new instance of unbounded, boxed <> array in Ada Mace Ayres
2021-07-14  6:18 ` J-P. Rosen [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