comp.lang.ada
 help / color / mirror / Atom feed
From: Lowe Anthony A <aalowe@cacd.rockwell.com>
Subject: Re: problem in changing Discriminants from access type
Date: 1998/05/11
Date: 1998-05-11T00:00:00+00:00	[thread overview]
Message-ID: <35577DC2.1A8D482B@cacd.rockwell.com> (raw)
In-Reply-To: 35577418.0@news1.ibm.net


Did the compiler tell which line would cause the constraint error?  On the first
declaration of the discriminant you have start at 1 and end at 0 resulting in
(1..0) which is definiatly a constraint error.

Tony

Gil Kaspi wrote:

> this program was build to simulate dynamic array .
> (it should be a package that has
>     type arr is private;   and    arr defenition is access to arr_node)
> ----------------------------------------------------------------------------
> -----------------
>
> procedure d_array is
>
>  type Arr_Node;
>
> type arr is access arr_node;
>
> type Test is array (Integer range <>) of Integer;
>
> subtype Int_Limits is Integer range -1000..1000;
>
> type Int_Arr is array (Int_Limits range <>) of Integer;
>
> type Arr_Node (Start : Int_Limits :=1; Ends : Int_Limits := 0) is
> record
>    Store : Int_Arr (Start..Ends);
> end record;
>
> -- declare --
> D_Arr : Arr;
>
> begin
>
> -- create --
> D_Arr := new Arr_Node'(Start => 1, Ends => 0, Store => (others => 0));
>
> -- change --
> D_Arr.all :=(Ends => Index, Start => Index , Store => (others =>1));
>
> end;
> ----------------------------------------------------------------------------
> ------------------------
>
> !!! first, writing this code without the access will work OK.
> running this code will raise CONSTRAINT_ERROR.
> the problem I think is hiding in the last line
>
> 10x 4 any1 that will help
> gil.



--
Tony Lowe                   Rockwell Collins
1431 Opus Place   -  Downers Grove, IL 60515
(630)-960-8603          Fax : (630)-960-8207






  reply	other threads:[~1998-05-11  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-12  0:00 problem in changing Discriminants from access type Gil Kaspi
1998-05-11  0:00 ` Lowe Anthony A [this message]
1998-05-11  0:00   ` Matthew Heaney
1998-05-11  0:00 ` Matthew Heaney
1998-05-12  0:00 ` Anonymous
replies disabled

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