From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_40,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3f267467312181f1,start X-Google-Attributes: gid103376,public From: Lowe Anthony A Subject: Re: problem in changing Discriminants from access type Date: 1998/05/11 Message-ID: <35577DC2.1A8D482B@cacd.rockwell.com>#1/1 X-Deja-AN: 352357348 Content-Transfer-Encoding: 7bit References: <35577418.0@news1.ibm.net> Content-Type: text/plain; charset=us-ascii Organization: Rockwell A&C Mime-Version: 1.0 Reply-To: aalowe@cacd.rockwell.com Newsgroups: comp.lang.ada Date: 1998-05-11T00:00:00+00:00 List-Id: 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