comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: index range while type (seemingly defined) to always include this particular value
Date: Thu, 4 Jan 2018 07:39:21 -0800 (PST)
Date: 2018-01-04T07:39:21-08:00	[thread overview]
Message-ID: <a01765b4-0fa2-4fa4-9ebc-d75c6d75a4c3@googlegroups.com> (raw)

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;





             reply	other threads:[~2018-01-04 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 15:39 Mehdi Saada [this message]
2018-01-04 16:19 ` index range while type (seemingly defined) to always include this particular value Jeffrey R. Carter
replies disabled

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