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=-1.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.107.52.11 with SMTP id b11mr3457679ioa.117.1515080361792; Thu, 04 Jan 2018 07:39:21 -0800 (PST) X-Received: by 10.157.16.82 with SMTP id o18mr247744oto.14.1515080361618; Thu, 04 Jan 2018 07:39:21 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!i6no216213itb.0!news-out.google.com!b73ni822ita.0!nntp.google.com!i6no216209itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 4 Jan 2018 07:39:21 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.240.212.224; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.240.212.224 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: index range while type (seemingly defined) to always include this particular value From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Thu, 04 Jan 2018 15:39:21 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2025 X-Received-Body-CRC: 4117200787 Xref: reader02.eternal-september.org comp.lang.ada:49751 Date: 2018-01-04T07:39:21-08:00 List-Id: This line: PUT(POLY.COEF(0)); raises Constraint Error: index check failed. I can't get my head round about this. Each time the function See below: 0 is ALWAYS in the index range of COEF, which is an array component. generic formal parameters: type T_DEGRE_BASE is range <>; MAX: in T_DEGRE_BASE; type definitions: subtype T_DEGRE is T_DEGRE_BASE range -MAX..MAX; type T_Vect_Coef is array (T_Degr type T_Polynome (Degre : T_Degre := 0) is record COEF : T_Vect_Coef (0..Degre) := (others => NULL_ELEMENT); end record;e range <>) of ELEMENT; And the actual generic parameters: package RAT is new P_RATIONNELS_G(T_ENTIER => INTEGER); package POLY is new P_POLY_V1_G(T_DEGRE_BASE => INTEGER, ELEMENT => RAT.T_RATIONNEL, NULL_ELEMENT => RAT.NULLE, MAX => 10, PUT => RAT_IO.PUT); Lastly: subtype T_Entier_Pos is T_Entier range 1..T_Entier'Last; type T_Rationnel is record Numerateur : T_Entier := 0; Denominateur: T_Entier_Pos := 1; end record;