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.36.74.5 with SMTP id k5mr955327itb.30.1516445723010; Sat, 20 Jan 2018 02:55:23 -0800 (PST) X-Received: by 10.157.90.130 with SMTP id w2mr67115oth.14.1516445722748; Sat, 20 Jan 2018 02:55:22 -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!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no1044612ita.0!news-out.google.com!b73ni3532ita.0!nntp.google.com!w142no1044611ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 20 Jan 2018 02:55:22 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.243.127.62; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.243.127.62 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <25736b03-e178-41ce-84fc-0e7da0e11420@googlegroups.com> Subject: "too few element" in an unconstrained array, given as litteral ? From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Sat, 20 Jan 2018 10:55:22 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 56551449 X-Received-Bytes: 3207 Xref: reader02.eternal-september.org comp.lang.ada:50019 Date: 2018-01-20T02:55:22-08:00 List-Id: The definitions for polynoms I slightly modified, don't fit anymore wit the= test program: 28 Set(Poly3,(2/1, 5/8)); -- but every call on Set does the same ts_poly1.adb:28:14: warning: too few elements for type "T_Liste_Coef" defin= ed at p_poly_v1_g.ads:48, instance at line 20 ts_poly1.adb:28:14: warning: "Constraint_Error" will be raised at run time 18 package PRat is new P_Rationnels_G(T_Entier); = =20 19 package PRatIO is new PRat.IO; = =20 20 package PPoly is new P_Poly_V1_G(PRat, PRatIO, 40); =20 _____________________________________ generic with package P_Rationnels is new P_Rationnels_G(<>); with package P_Rationnels_io is new P_Rationnels.Io(<>); Max : Positive; package PPoly is _____________________________________ subtype T_Degre is T_Entier range 0..T_Entier(Max); -- I found this phrasin= g ugly as hell, but I don't know how to make T_Entier visible in the "gener= ic" part since p_rationnels is yet to be instanciated... But I guess it's n= ot the cause of the exception here. In the test program: Set(Poly3,(2/11)); -- any call of Set raises constrain= t_error The current definitions: type T_Liste_Coef is array (T_Degre range 1..T_Degre'Last) of T_Rationnel; type T_Vect_Coef is array (T_Degre range <>) of T_Rationnel; type T_Polynome (Degre : T_Degre :=3D 0) is -- type mutant record Coef : T_Vect_Coef (0..Degre) :=3D (others =3D> Nulle); end record; And the constructor method: : procedure Set ( Poly : out T_Polynome; Vect : in T_Liste_Coef ) is V_Coef : T_Vect_Coef (0 .. Vect'Last - 1); begin for I in Vect'range loop V_Coef (I - 1) :=3D Vect (I); end loop; Poly :=3D (Vect'Length - 1, V_Coef); end Set; How can an object of an UNCONSTAINED array type, given as a litteral, have = "too few elements ?", though sometime I saw "too few" means "too much", but= it wouldn't make more sense to me either.