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.61.149 with SMTP id n143mr27895383itn.48.1514670128846; Sat, 30 Dec 2017 13:42:08 -0800 (PST) X-Received: by 10.157.16.82 with SMTP id o18mr100527oto.14.1514670128652; Sat, 30 Dec 2017 13:42:08 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!g80no4187942itg.0!news-out.google.com!b73ni16026ita.0!nntp.google.com!i6no4197319itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 30 Dec 2017 13:42:08 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.242.254.223; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.242.254.223 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <053b2370-5c15-4662-a9e3-e1464de206a1@googlegroups.com> Subject: formal array types and default values From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Sat, 30 Dec 2017 21:42:08 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 1972 X-Received-Body-CRC: 2224733185 Xref: reader02.eternal-september.org comp.lang.ada:49703 Date: 2017-12-30T13:42:08-08:00 List-Id: I have several questions more or less related. First: why aspect DEFAULT_COMPONENT_VALUE can apply only to components of scalar type ? It would be nice to be able to set a default value to an array type in a generic package, equal to a generic object parameter. type T_Vect_Coef is array (T_Degre range <>) of ELEMENT; gives that message: main.adb:21:22: unconstrained subtype not allowed (need initialization) main.adb:21:22: provide initial value or explicit array bounds ELEMENT and T_DEGRE are generic and declared like that: type ELEMENT is private; type T_DEGRE is range <>; Those two types are public. How can I give a default value, since DEFAULT_COMPONENT_VALUE doesn't apply to non scalar types. In the private part, the type type T_Polynome (Degre : T_Degre := 0) is -- type mutant record COEF : T_Vect_Coef (0..Degre) := (others => NULL_ELEMENT); end record; gives that warning: creation of "T_Polynome" object may raise Storage_Error. Why?